Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support negation/subtraction of nested_tensor #86889

Closed
frankier opened this issue Oct 13, 2022 · 1 comment
Closed

Support negation/subtraction of nested_tensor #86889

frankier opened this issue Oct 13, 2022 · 1 comment
Labels
module: nestedtensor NestedTensor tag see issue #25032 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@frankier
Copy link
Contributor

frankier commented Oct 13, 2022

馃殌 The feature, motivation and pitch

These operations are not currently supported. Since add is supported, the implementation might not be too much work.

>>> - torch.nested.nested_tensor([torch.tensor([-2.3, 0.4, 5.3]), torch.tensor([-2.3, 0.4, 5.3])])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NotImplementedError: Could not run 'aten::neg' with arguments from the 'NestedTensorCPU' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'aten::neg' is only available for these backends: [CPU, CUDA, HIP, MPS, IPU, XPU, HPU, VE, Meta, PrivateUse1, PrivateUse2, PrivateUse3, FPGA, ORT, Vulkan, Metal, QuantizedCPU, QuantizedCUDA, QuantizedHIP, QuantizedMPS, QuantizedIPU, QuantizedXPU, QuantizedHPU, QuantizedVE, QuantizedMeta, QuantizedPrivateUse1, QuantizedPrivateUse2, QuantizedPrivateUse3, CustomRNGKeyId, MkldnnCPU, SparseCPU, SparseCsrCPU, SparseCsrCUDA, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradHIP, AutogradXLA, AutogradMPS, AutogradIPU, AutogradXPU, AutogradHPU, AutogradVE, AutogradLazy, AutogradMeta, AutogradPrivateUse1, AutogradPrivateUse2, AutogradPrivateUse3, AutogradNestedTensor, Tracer, AutocastCPU, AutocastCUDA, FuncTorchBatched, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PythonDispatcher].

Alternatives

Depending on the situation, it may be possible to negate all values before putting them into the nested_tensor. Or else unbind() could be used and work inner tensor at a time.

Additional context

No response

cc @cpuhrsch @jbschlosser @bhosmer @drisspg @mikaylagawarecki

@malfet malfet added the module: nestedtensor NestedTensor tag see issue #25032 label Oct 13, 2022
@H-Huang H-Huang added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Oct 13, 2022
@cpuhrsch
Copy link
Contributor

cpuhrsch commented Nov 1, 2022

@frankier - we just landed support for neg. It should become available in the nightlies within the next 48 hours. Can you just confirm that this is what you wanted and otherwise please reopen the issue? Thanks

pytorchmergebot pushed a commit that referenced this issue Nov 3, 2022
kulinseth pushed a commit to kulinseth/pytorch that referenced this issue Nov 5, 2022
kulinseth pushed a commit to kulinseth/pytorch that referenced this issue Nov 5, 2022
kulinseth pushed a commit to kulinseth/pytorch that referenced this issue Dec 10, 2022
kulinseth pushed a commit to kulinseth/pytorch that referenced this issue Dec 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: nestedtensor NestedTensor tag see issue #25032 triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants