MCPcopy Create free account
hub / github.com/pytorch/pytorch / byteswap

Method byteswap

torch/storage.py:264–270  ·  view source on GitHub ↗

Swap bytes in underlying data.

(self, dtype)

Source from the content-addressed store, hash-verified

262 return self
263
264 def byteswap(self, dtype):
265 """Swap bytes in underlying data."""
266 elem_size = torch._utils._element_size(dtype)
267 # for complex types, don't swap first and second numbers
268 if dtype.is_complex:
269 elem_size = max(int(elem_size / 2), 1)
270 self._byteswap(elem_size)
271
272
273def _share_memory_lock_protected(fn):

Callers 3

load_tensorFunction · 0.80
test_storage_byteswapMethod · 0.80
test_byteorder_checkMethod · 0.80

Calls 3

_byteswapMethod · 0.95
_element_sizeMethod · 0.80
maxFunction · 0.50

Tested by 2

test_storage_byteswapMethod · 0.64
test_byteorder_checkMethod · 0.64