Open tnwei opened 2 years ago
Thanks! Someone else mentioned this as well. Needs to be fixed.
Indeed, this issue occurs when all the operations do not return a float.
I manage to pass the test with Add.apply(self, Neg.apply(b))
by defining the negation operation as:
return -1.0 * x
For Task 1.2, I believe the intended code for
scalar.Scalar.__sub__
isreturn Add.apply(self, -b)
, which passes the tests. Interestingly, ifreturn Add.apply(self, Neg.apply(b))
is used, the tests that involve subtracting constants fail. Excerpt of the failed test cases below:I've slightly modified the error message in
autodiff.FunctionBase
to print the offending value in question, and they are all ints. The root cause is due toscalar.ScalarFunction.data_type
being hard-coded asfloat
. I assumedata_type
is fixed for a reason, and there probably isn't an easy fix to allow the alternate solution to pass the tests. Just thought y'all should know.