Add itemsize and nbytes properties to Tensor (#98322)

Adds properties for itemsize and nbytes to Tensor matching the properties in NumPy.

Fixes https://github.com/pytorch/pytorch/issues/12728

Pull Request resolved: https://github.com/pytorch/pytorch/pull/98322
Approved by: https://github.com/ezyang
This commit is contained in:
BJ Hargrave
2023-04-05 12:11:55 +00:00
committed by PyTorch MergeBot
parent 14ccad73b4
commit 555ab310dc
10 changed files with 85 additions and 0 deletions

View File

@ -157,6 +157,8 @@ _SKIP_PYTHON_BINDINGS = [
"_nested_view_from_buffer", # View only version of _nested_from_buffer. This will force users to only use the "safe" version.
"_nested_view_from_buffer_copy",
"_nested_view_from_buffer_copy_out",
"nbytes",
"itemsize",
]
SKIP_PYTHON_BINDINGS = [