Issue
let tensor1 = tf.tensor(m1);
let tensor2 = tf.tensor(m2);
console.log(tensor1.shape, tensor2.shape)
result = tf.matMul(tensor1, tensor2)
The output of shapes are => [ 6890, 3, 10 ] [ 10 ]
While trying to use matMul this is the error => Error: Error in matMul: inner shapes (10) and (undefined) of Tensors with shapes 6890,3,10 and 10 and transposeA=false and transposeB=false must match.
The same multiplication works fine in python using numpy's matmul.
Solution
Maybe something like this:
let tensor1 = tf.randomNormal([6890, 3, 10]);
let tensor2 = tf.randomNormal([10]).expandDims(-1);
result = tf.matMul(tensor1, tensor2).squeeze(-1)
console.log(result.shape)
[6890,3]
Answered By - AloneTogether
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.