-
Notifications
You must be signed in to change notification settings - Fork 167
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
Can't set Tensor
slice using indexing
#521
Comments
Was there any reason why this void THSTensor_set1t(const Tensor tensor, int64_t index, const Tensor value) And replacing the call above with THSTensor_set1t(Handle, i, value.Handle); seems to be working fine. |
@lostmsu -- yeah, I can't figure out why it would want the source to be a Scalar there. There's a reason to special-case for the index being an integer, but not for the value to be scalar, I think. I think the same applies to set2-set6, Put it in a PR, and we can get it into 0.96.1. I also just noted that all the C# extern declarations of THSTensor_setN methods should be void-returning, not IntPtr. |
In the meantime, you should be able to rely on the TensorIndex versions of the indexer. |
BTW, I usually add at least one regression test to the 'TestTorchTensorBugs.cs' file when I have a small enough repro. |
@NiklasGustafsson can I replace the existing definitions? Should I even be worried about having incompatible C++ signatures between 0.96.0 and 0.96.1? |
Until we get to 1.0, we are unapologetically making breaking changes and there's no guarantee of binary compatibility. Breaking changes need to be highlighted in the RELEASENOTES, but otherwise, let's just get things in order. The existing code is clearly incorrect. |
The parameter groups support will also be a breaking change because optimizers won't have a scalar 'LearningRate' property (those go with the parameter groups). |
Tensor int-based indexers forced `AsScalar()` call on assigned tensors, which prevented assigning tensor slices. fixes dotnet#521
Tensor int-based indexers forced `AsScalar()` call on assigned tensors, which prevented assigning tensor slices. fixes dotnet#521
This fails:
Error happens here:
Because the value is not a scalar.
Workaround
The text was updated successfully, but these errors were encountered: