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


Java Nd4j.gemm方法代码示例

本文整理汇总了Java中org.nd4j.linalg.factory.Nd4j.gemm方法的典型用法代码示例。如果您正苦于以下问题:Java Nd4j.gemm方法的具体用法?Java Nd4j.gemm怎么用?Java Nd4j.gemm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.nd4j.linalg.factory.Nd4j的用法示例。


在下文中一共展示了Nd4j.gemm方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ax

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public double[] ax(double[] x, double[] y) {
    // Nd4j.getBlasWrapper().level2().gemv() crashes.
    // Use gemm for now.
    int m = nrows();
    int n = ncols();
    INDArray ndx = Nd4j.create(x, new int[]{n, 1});
    INDArray ndy = Nd4j.gemm(A, ndx, false, false);
    for (int i = 0; i < m; i++) {
        y[i] = ndy.getDouble(i);
    }

    return y;
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:15,代码来源:NDMatrix.java

示例2: axpy

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public double[] axpy(double[] x, double[] y) {
    // Nd4j.getBlasWrapper().level2().gemv() crashes.
    // Use gemm for now.
    int m = nrows();
    int n = ncols();
    INDArray ndx = Nd4j.create(x, new int[]{n, 1});
    INDArray ndy = Nd4j.gemm(A, ndx, false, false);
    for (int i = 0; i < m; i++) {
        y[i] += ndy.getDouble(i);
    }

    return y;
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:15,代码来源:NDMatrix.java

示例3: atx

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public double[] atx(double[] x, double[] y) {
    // Nd4j.getBlasWrapper().level2().gemv() crashes.
    // Use gemm for now.
    int m = nrows();
    int n = ncols();
    INDArray ndx = Nd4j.create(x, new int[]{m, 1});
    INDArray ndy = Nd4j.gemm(A, ndx, true, false);
    for (int i = 0; i < n; i++) {
        y[i] = ndy.getDouble(i);
    }

    return y;
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:15,代码来源:NDMatrix.java

示例4: atxpy

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public double[] atxpy(double[] x, double[] y) {
    // Nd4j.getBlasWrapper().level2().gemv() crashes.
    // Use gemm for now.
    int m = nrows();
    int n = ncols();
    INDArray ndx = Nd4j.create(x, new int[]{m, 1});
    INDArray ndy = Nd4j.gemm(A, ndx, true, false);
    for (int i = 0; i < n; i++) {
        y[i] += ndy.getDouble(i);
    }

    return y;
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:15,代码来源:NDMatrix.java

示例5: abmm

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix abmm(DenseMatrix B) {
    if (B instanceof NDMatrix) {
        NDMatrix b = (NDMatrix) B;
        return new NDMatrix(Nd4j.gemm(A, b.A, false, false));
    }

    throw new IllegalArgumentException("NDMatrix.abmm() parameter must be NDMatrix");
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:10,代码来源:NDMatrix.java

示例6: abtmm

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix abtmm(DenseMatrix B) {
    if (B instanceof NDMatrix) {
        NDMatrix b = (NDMatrix) B;
        return new NDMatrix(Nd4j.gemm(A, b.A, false, true));
    }

    throw new IllegalArgumentException("NDMatrix.abtmm() parameter must be NDMatrix");
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:10,代码来源:NDMatrix.java

示例7: atbmm

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix atbmm(DenseMatrix B) {
    if (B instanceof NDMatrix) {
        NDMatrix b = (NDMatrix) B;
        return new NDMatrix(Nd4j.gemm(A, b.A, true, false));
    }

    throw new IllegalArgumentException("NDMatrix.abtmm() parameter must be NDMatrix");
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:10,代码来源:NDMatrix.java

示例8: ata

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix ata() {
    return new NDMatrix(Nd4j.gemm(A, A, true, false));
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:5,代码来源:NDMatrix.java

示例9: aat

import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix aat() {
    return new NDMatrix(Nd4j.gemm(A, A, false, true));
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:5,代码来源:NDMatrix.java


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