本文整理匯總了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));
}