本文整理了Java中org.nd4j.linalg.factory.Nd4j.randn()
方法的一些代码示例,展示了Nd4j.randn()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Nd4j.randn()
方法的具体详情如下:
包路径:org.nd4j.linalg.factory.Nd4j
类名称:Nd4j
方法名:randn
[英]Random normal N(0,1) with the specified shape and array order
[中]具有指定形状和数组顺序的随机法线N(0,1)
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal N(0,1) with the specified shape and array order
*
* @param order the order of the output array
* @param rows the number of rows in the matrix
* @param columns the number of columns in the matrix
*/
public static INDArray randn(char order, long rows, long columns) {
INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order);
logCreationIfNecessary(ret);
return randn(ret);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal N(0,1) with the specified shape and array order
*
* @param order order of the output ndarray
* @param shape the shape of the ndarray
*/
public static INDArray randn(char order, long[] shape) {
INDArray ret = Nd4j.createUninitialized(shape, order);
logCreationIfNecessary(ret);
return randn(ret);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal N(0,1) with the specified shape and array order
*
* @param order order of the output ndarray
* @param shape the shape of the ndarray
*/
public static INDArray randn(char order, int[] shape) {
INDArray ret = Nd4j.createUninitialized(shape, order);
logCreationIfNecessary(ret);
return randn(ret);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the specified seed
*
* @param shape the shape of the ndarray
* @return
*/
public static INDArray randn(int[] shape, long seed) {
INDArray ret = Nd4j.createUninitialized(shape, order());
logCreationIfNecessary(ret);
return randn(ret, seed);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the current time stamp
* as the seed
*
* @param shape the shape of the ndarray
* @return
*/
public static INDArray randn(int[] shape) {
INDArray ret = Nd4j.createUninitialized(shape, order());
logCreationIfNecessary(ret);
return randn(ret);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the specified seed
*
* @param rows the number of rows in the matrix
* @param columns the number of columns in the matrix
* @return
*/
public static INDArray randn(long rows, long columns, long seed) {
INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order());
logCreationIfNecessary(ret);
return randn(ret, seed);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the given rng
*
* @param shape the shape of the ndarray
* @param r the random generator to use
* @return
*/
public static INDArray randn(int[] shape, org.nd4j.linalg.api.rng.Random r) {
final INDArray ret = Nd4j.createUninitialized(shape, order());
logCreationIfNecessary(ret);
return randn(ret, r);
}
代码示例来源:origin: deeplearning4j/nd4j
public static INDArray randn(long[] shape) {
INDArray ret = Nd4j.createUninitialized(shape, order());
logCreationIfNecessary(ret);
return randn(ret);
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the given rng
*
* @param shape the shape of the ndarray
* @param r the random generator to use
* @return
*/
public static INDArray randn(long[] shape, org.nd4j.linalg.api.rng.Random r) {
final INDArray ret = Nd4j.createUninitialized(shape, order());
logCreationIfNecessary(ret);
return randn(ret, r);
}
代码示例来源:origin: deeplearning4j/nd4j
@Override
public INDArray doCreate(long[] shape, INDArray paramsView) {
return Nd4j.randn(order(), shape).divi(FastMath.sqrt(fanIn));
}
代码示例来源:origin: deeplearning4j/nd4j
@Override
public INDArray doCreate(long[] shape, INDArray paramsView) {
return Nd4j.randn(order(), shape).muli(FastMath.sqrt(2.0 / (fanIn + fanOut)));
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the given rng
*
* @param rows the number of rows in the matrix
* @param columns the number of columns in the matrix
* @param r the random generator to use
* @return
*/
public static INDArray randn(long rows, long columns, org.nd4j.linalg.api.rng.Random r) {
INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order());
logCreationIfNecessary(ret);
return randn(ret, r);
}
代码示例来源:origin: deeplearning4j/nd4j
@Override
public INDArray doCreate(long[] shape, INDArray paramsView) {
return Nd4j.randn(order(), shape).divi(FastMath.sqrt(fanOut));
}
代码示例来源:origin: deeplearning4j/nd4j
@Override
public INDArray doCreate(long[] shape, INDArray paramsView) {
return Nd4j.randn(order(), shape).divi(FastMath.sqrt(fanIn));
}
代码示例来源:origin: deeplearning4j/nd4j
/**
* Random normal using the current time stamp
* as the seed
*
* @param rows the number of rows in the matrix
* @param columns the number of columns in the matrix
* @return
*/
public static INDArray randn(long rows, long columns) {
INDArray ret = Nd4j.createUninitialized(new long[]{rows, columns}, order());
logCreationIfNecessary(ret);
return randn(ret);
}
代码示例来源:origin: deeplearning4j/nd4j
@Override
public INDArray doCreate(long[] shape, INDArray paramsView) {
return Nd4j.randn(order(), shape).divi(FastMath.sqrt((fanIn + fanOut) / 2));
}
代码示例来源:origin: deeplearning4j/nd4j
@Override
public INDArray doCreate(long[] shape, INDArray paramsView) {
return Nd4j.randn(order(), shape).muli(FastMath.sqrt(2.0 / fanIn)); //N(0, 2/nIn);
}
代码示例来源:origin: deeplearning4j/dl4j-examples
System.out.println("Full precision of random value at position (0,0): " + uniformRandom.getDouble(0,0));
INDArray gaussianMeanZeroUnitVariance = Nd4j.randn(shape);
System.out.println("\nN(0,1) random array:");
System.out.println(gaussianMeanZeroUnitVariance);
代码示例来源:origin: deeplearning4j/nd4j
/**
* Generates a set of <i>count</i> random samples with the same variance and mean and eigenvector/values
* as the data set used to initialize the PCA object, with same number of features <i>N</i>.
* @param count The number of samples to generate
* @return A matrix of size <i>count</i> rows by <i>N</i> columns
*/
public INDArray generateGaussianSamples(long count) {
INDArray samples = Nd4j.randn(new long[] {count, eigenvalues.columns()});
INDArray factors = Transforms.pow(eigenvalues, -0.5, true);
samples.muliRowVector(factors);
return Nd4j.tensorMmul(eigenvectors, samples, new int[][] {{1}, {1}}).transposei().addiRowVector(mean);
}
代码示例来源:origin: org.nd4j/nd4j-api
/**
* Generates a set of <i>count</i> random samples with the same variance and mean and eigenvector/values
* as the data set used to initialize the PCA object, with same number of features <i>N</i>.
* @param count The number of samples to generate
* @return A matrix of size <i>count</i> rows by <i>N</i> columns
*/
public INDArray generateGaussianSamples(int count) {
INDArray samples = Nd4j.randn(count, eigenvalues.columns());
INDArray factors = Transforms.pow(eigenvalues, -0.5, true);
samples.muliRowVector(factors);
return Nd4j.tensorMmul(eigenvectors, samples, new int[][] {{1}, {1}}).transposei().addiRowVector(mean);
}
内容来源于网络,如有侵权,请联系作者删除!