-
Notifications
You must be signed in to change notification settings - Fork 685
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.UnsupportedOperationException: Dimension mismatch or high dimensional dot operation is not supported. Please use .matMul instead. #2685
Comments
Did this specifically happened at this computation?
Have you tried the matMul as suggested in the error message? I think i spot one possble error that causes dimension mismatch when doing X.dot(w)
Here, in NDArray X = manager.randomNormal(new Shape(numExamples, w.size())); |
hi @KexinFeng, Thanks for your response.
Yes.
There is not enough information for me to go ahead with this. But what I'm using is based on the textbook here:
Here is what I changed it to:
It still fails with the error:
Have you got a suggestion? |
The reason of changing it is to make sure that in |
I found the error. The dot operation only applies on 1D vectors. Please do further change of changing .dot to .matMul |
Thankyou - that fixed it. |
Description
Running Deep Java Learning Exercise 3.2 on an M1 Mac in Java 11 with Pytorch leads to the Exception:
java.lang.UnsupportedOperationException: Dimension mismatch or high dimensional dot operation is not supported. Please use .matMul instead.
Expected Behavior
The code completes and shows a scatterplot of Synthetic Data.
Error Message
How to Reproduce?
(If you developed your own code, please provide a short script that reproduces the error. For existing examples, please provide link.)
Maven
pom.xml
Java class
Exercise3_2_LinearRegressionFromScratch
Steps to reproduce
(Paste the commands you ran that produced the error.)
export DJL_DEFAULT_ENGINE=PyTorch
(via IntelliJ run configuration)Exercise3_2_LinearRegressionFromScratch
What have you tried to solve it?
Implement Linear Regression From Scratch
https://d2l.djl.ai/chapter_linear-networks/linear-regression-scratch.htmlEnvironment Info
Please run the command
./gradlew debugEnv
from the root directory of DJL (if necessary, clone DJL first). It will output information about your system, environment, and installation that can help us debug your issue. Paste the output of the command below:Via Intellij configuration.
The text was updated successfully, but these errors were encountered: