djl
djl copied to clipboard
Dimension mismatch or high dimensional dot operation is not supported
Code : NDManager manager = NDManager.newBaseManager(); NDArray X = manager.randomNormal(new Shape(1, 2)); NDArray trueW = manager.create(new float[]{2, -3.4f}); X.dot(trueW); Exception Dimension mismatch or high dimensional dot operation is not supported. Please use .matMul instead.
The engine is pytorch-engine and the environment is windows cpu
Thanks
@foolfish1
Can you use X.matMul(trueW)?
See: https://pytorch.org/docs/stable/generated/torch.dot.html
The issue can also be solved by specifying the Shape:
NDArray trueW = manager.create(new float[]{2, -3.4f}, new Shape(2, 1));
But as instructed, .matMul is suggested.