當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。