本文整理汇总了Java中org.nd4j.linalg.factory.Nd4j.saveBinary方法的典型用法代码示例。如果您正苦于以下问题:Java Nd4j.saveBinary方法的具体用法?Java Nd4j.saveBinary怎么用?Java Nd4j.saveBinary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.nd4j.linalg.factory.Nd4j
的用法示例。
在下文中一共展示了Nd4j.saveBinary方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeDims
import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
/**
* Store the mean/std values for width/height of each (populated) omr shape.
*
* @throws IOException on IO error
*/
private void storeDims ()
throws IOException
{
INDArray dimStats = Nd4j.zeros(4, SHAPE_COUNT);
logger.info("Symbol dimensions for populated shapes:");
for (Entry<OmrShape, DistributionStats.Builder> entry : dimMap.entrySet()) {
OmrShape shape = entry.getKey();
DistributionStats.Builder builder = entry.getValue();
DistributionStats stats = builder.build();
INDArray means = stats.getMean();
INDArray stds = stats.getStd();
int index = shape.ordinal();
double meanWidth = means.getDouble(0);
double stdWidth = stds.getDouble(0);
double meanHeight = means.getDouble(1);
double stdHeight = stds.getDouble(1);
dimStats.putScalar(new int[]{0, index}, meanWidth);
dimStats.putScalar(new int[]{1, index}, stdWidth);
dimStats.putScalar(new int[]{2, index}, meanHeight);
dimStats.putScalar(new int[]{3, index}, stdHeight);
logger.info(
String.format(
"%27s width{mean:%.2f std:%.2f} height{mean:%.2f std:%.2f}",
shape,
meanWidth,
stdWidth,
meanHeight,
stdHeight));
}
Nd4j.saveBinary(dimStats, DIMS_PATH.toFile());
}