本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
示例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");
}
示例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");
}
示例8: ata
import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix ata() {
return new NDMatrix(Nd4j.gemm(A, A, true, false));
}
示例9: aat
import org.nd4j.linalg.factory.Nd4j; //导入方法依赖的package包/类
@Override
public NDMatrix aat() {
return new NDMatrix(Nd4j.gemm(A, A, false, true));
}