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

Method __setitem__

torch/_numpy/_ndarray.py:448–456  ·  view source on GitHub ↗
(self, index, value)

Source from the content-addressed store, hash-verified

446 return ndarray(tensor.__getitem__(index))
447
448 def __setitem__(self, index, value):
449 index = _util.ndarrays_to_tensors(index)
450 index = _upcast_int_indices(index)
451
452 if not _dtypes_impl.is_scalar(value):
453 value = normalize_array_like(value)
454 value = _util.cast_if_needed(value, self.tensor.dtype)
455
456 return self.tensor.__setitem__(index, value)
457
458 take = _funcs.take
459 put = _funcs.put

Callers

nothing calls this directly

Calls 4

_upcast_int_indicesFunction · 0.85
normalize_array_likeFunction · 0.85
is_scalarMethod · 0.45
__setitem__Method · 0.45

Tested by

no test coverage detected