This is a fix for issue #52
I investigated further and found that the generated methods (MulScalar) work as expected. However, the problem lies in this comment:
// MulScalar performs t × s elementwise. The leftTensor parameter indicates if the tensor is the left operand. **Only scalar types are accepted in s.**
But the Mul method (in api_arith.go) was not taking that into account when the 2 parameters are tensors (including "scalar tensors"), and was sending a non-scalar tensor to the "s" parameter. The swapping of parameter is correctly done in other branches, when doing a Mul with non-tensor arguments.
For the other operations, the case of scalar tensors was not taken into account.
Coverage increased (+0.2%) to 72.986% when pulling 1265ce698a07f997b01b28459f42b0b3b78050cb on bezineb5:fix-scalar-ops into ea8ef1f6e3b11e8476fb8ac81ae37fe6f749fc18 on gorgonia:master.
This is a fix for issue #52 I investigated further and found that the generated methods (MulScalar) work as expected. However, the problem lies in this comment:
// MulScalar performs t × s elementwise. The leftTensor parameter indicates if the tensor is the left operand. **Only scalar types are accepted in s.**
But the Mul method (in api_arith.go) was not taking that into account when the 2 parameters are tensors (including "scalar tensors"), and was sending a non-scalar tensor to the "s" parameter. The swapping of parameter is correctly done in other branches, when doing a Mul with non-tensor arguments.For the other operations, the case of scalar tensors was not taken into account.
I hope this helps and clarifies, Thanks!