torch.Tensor.element_size
-
Tensor.element_size() → int -
Возвращает размер отдельного элемента в байтах.
Пример:
>>> torch.tensor([]).element_size() 4 >>> torch.tensor([], dtype=torch.uint8).element_size() 1
© 2026, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.14/generated/torch.Tensor.element_size.html