org.nd4j.linalg.factory.Nd4j.order()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(210)

本文整理了Java中org.nd4j.linalg.factory.Nd4j.order()方法的一些代码示例,展示了Nd4j.order()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Nd4j.order()方法的具体详情如下:
包路径:org.nd4j.linalg.factory.Nd4j
类名称:Nd4j
方法名:order

Nd4j.order介绍

[英]Returns the ordering of the ndarrays
[中]返回数据数组的顺序

代码示例

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Create an ndarray
  3. * with the given shape
  4. * @param shape
  5. */
  6. public BaseNDArray(int[] shape) {
  7. this(shape, 0, Nd4j.order());
  8. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Creates a new <i>n</i> times <i>m</i> <tt>DoubleMatrix</tt>.
  3. *
  4. * @param newRows the number of rows (<i>n</i>) of the new matrix.
  5. * @param newColumns the number of columns (<i>m</i>) of the new matrix.
  6. */
  7. public BaseNDArray(int newRows, int newColumns) {
  8. this(newRows, newColumns, Nd4j.order());
  9. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Create an ndarray from the specified slices.
  3. * This will go through and merge all of the
  4. * data from each slice in to one ndarray
  5. * which will then take the specified shape
  6. *
  7. * @param slices the slices to merge
  8. * @param shape the shape of the ndarray
  9. */
  10. public BaseNDArray(List<INDArray> slices, int[] shape) {
  11. this(slices, shape, Nd4j.order());
  12. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Create with the specified ndarray as the real component
  3. * and the given stride
  4. *
  5. * @param m the ndarray to use as the stride
  6. * @param stride the stride of the ndarray
  7. */
  8. public BaseComplexNDArray(INDArray m, int[] stride) {
  9. this(m, stride, Nd4j.order());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Create an ndarray from the specified slices
  3. * and the given shape
  4. *
  5. * @param slices the slices of the ndarray
  6. * @param shape the final shape of the ndarray
  7. * @param stride the stride of the ndarray
  8. */
  9. public BaseComplexNDArray(List<IComplexNDArray> slices, int[] shape, int[] stride) {
  10. this(slices, shape, stride, Nd4j.order());
  11. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. *
  3. * @param buffer
  4. * @param shape
  5. * @param strides
  6. */
  7. public BaseNDArray(DataBuffer buffer, int[] shape, int[] strides) {
  8. this(buffer, shape, strides, 0, Nd4j.order());
  9. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Initialize the ndarray
  3. * with the given data
  4. * @param data
  5. */
  6. public BaseNDArray(float[][] data) {
  7. this(data, Nd4j.order());
  8. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. *
  3. * @param data
  4. * @param shape
  5. */
  6. public BaseNDArray(DataBuffer data, int[] shape) {
  7. this(data, shape, Nd4j.getStrides(shape, Nd4j.order()), 0, Nd4j.order());
  8. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Creates an ndarray with the specified shape
  3. *
  4. * @param shape the shape of the ndarray
  5. * @return the instance
  6. */
  7. public static INDArray create(int... shape) {
  8. return create(shape, order());
  9. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. *
  3. * @param data
  4. * @param shape
  5. * @param offset
  6. * @return
  7. */
  8. public static IComplexNDArray createComplex(double[] data, int[] shape, long offset) {
  9. return createComplex(data, shape, offset, Nd4j.order());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Creates an ndarray with the specified shape
  3. *
  4. * @param shape the shape of the ndarray
  5. * @param stride the stride for the ndarray
  6. * @return the instance
  7. */
  8. public static INDArray create(int[] shape, int[] stride) {
  9. return create(shape, stride, order());
  10. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Creates a complex ndarray with the specified shape
  3. *
  4. * @param shape the shape of the ndarray
  5. * @return the instance
  6. */
  7. public static IComplexNDArray createComplex(int... shape) {
  8. return createComplex(shape, order());
  9. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Cretes uninitialized INDArray detached from any (if any) workspace
  3. *
  4. * @param shape
  5. * @return
  6. */
  7. public static INDArray createUninitializedDetached(int[] shape) {
  8. return createUninitializedDetached(shape, Nd4j.order());
  9. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Get the strides based on the shape
  3. * and NDArrays.order()
  4. *
  5. * @param shape the shape of the ndarray
  6. * @return the strides for the given shape
  7. * and order specified by NDArrays.order()
  8. */
  9. public static int[] getComplexStrides(int[] shape) {
  10. return getComplexStrides(shape, Nd4j.order());
  11. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * This method creates shapeInformation buffer, based on shape being passed in
  3. *
  4. * @param shape
  5. * @return
  6. */
  7. @Override
  8. public Pair<DataBuffer, long[]> createShapeInformation(long[] shape) {
  9. char order = Nd4j.order();
  10. return createShapeInformation(shape, order);
  11. }

代码示例来源:origin: deeplearning4j/nd4j

  1. public static INDArray createUninitialized(long length) {
  2. if (length < 1)
  3. throw new IllegalStateException("INDArray length should be positive value");
  4. long[] shape = new long[] {1, length};
  5. INDArray ret = INSTANCE.createUninitialized(shape, order());
  6. logCreationIfNecessary(ret);
  7. return ret;
  8. }

代码示例来源:origin: deeplearning4j/nd4j

  1. @Override
  2. public INDArray valueArrayOf(long[] shape, double value) {
  3. INDArray ret = Nd4j.createUninitialized(shape, Nd4j.order());
  4. ret.assign(value);
  5. return ret;
  6. }

代码示例来源:origin: deeplearning4j/nd4j

  1. public static INDArray rand(long[] shape) {
  2. INDArray ret = createUninitialized(shape, order()); //INSTANCE.rand(shape, Nd4j.getRandom());
  3. logCreationIfNecessary(ret);
  4. return rand(ret);
  5. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Create a random ndarray with the given shape using the given RandomGenerator
  3. *
  4. * @param shape the shape of the ndarray
  5. * @param rng the random generator to use
  6. * @return the random ndarray with the specified shape
  7. */
  8. public static INDArray rand(int[] shape, org.nd4j.linalg.api.rng.Random rng) {
  9. INDArray ret = createUninitialized(shape, Nd4j.order()); //INSTANCE.rand(shape, rng);
  10. logCreationIfNecessary(ret);
  11. return rand(ret, rng);
  12. }

代码示例来源:origin: deeplearning4j/nd4j

  1. /**
  2. * Random normal using the specified seed
  3. *
  4. * @param shape the shape of the ndarray
  5. * @return
  6. */
  7. public static INDArray randn(int[] shape, long seed) {
  8. INDArray ret = Nd4j.createUninitialized(shape, order());
  9. logCreationIfNecessary(ret);
  10. return randn(ret, seed);
  11. }

相关文章