waylonflinn / weblas

GPU Powered BLAS for Browsers :gem:
MIT License
702 stars 43 forks source link

transfer() or tranfer() #50

Open blackcement opened 4 years ago

blackcement commented 4 years ago

Help me please. Can't figure it out right?

In one example, transfer () https://github.com/waylonflinn/weblas/wiki/Pipeline

in another tranfer () https://github.com/waylonflinn/weblas

Both options do not work

Uncaught TypeError: Cannot read property 'transfer' of undefined at weblas.html:20

<script type="text/javascript" src="./dist/weblas.js"></script>

<script>

var height_A = 52, width_A = 52,
    height_B = 52, width_B = 52;

var A = new Float32Array(height_A * width_A);
var B = new Float32Array(height_B * width_B);

    for (let k = 0; k < height_A*width_A; k++) 
    {
        A[k] =Math.random();
        B[k] =Math.random();
    }

var shape = [M, N]; // Строки столбцы
var t0 = weblas.pipeline.Tensor(shape, A);  
//var t1 = weblas.pipeline.sscal(1, 1, t0);

var result = t0.transfer();  // <<----<<----<<----<<----<<----
console.log('t0 = ', result);

var M = height_A,
    N = width_B,
    K = height_B; // must match width_A

var alpha = 1;
var beta = 1;
var C = new Float32Array(width_B)      // specialized for neural net bias calculation

//result = weblas.sgemm(M, N, K, alpha, A, B, beta, C);
//console.log(result);
</script>