当前位置: 首页>>代码示例>>Java>>正文


Java Nd4j.saveBinary方法代码示例

本文整理汇总了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());
}
 
开发者ID:Audiveris,项目名称:omr-dataset-tools,代码行数:39,代码来源:Features.java


注:本文中的org.nd4j.linalg.factory.Nd4j.saveBinary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。