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

Method __getitem__

torch/_numpy/_ndarray.py:58–67  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

56 raise AttributeError(f"No flag attribute '{attr}'")
57
58 def __getitem__(self, key):
59 if key in SHORTHAND_TO_FLAGS.keys():
60 key = SHORTHAND_TO_FLAGS[key]
61 if key in FLAGS:
62 try:
63 return self._flag_to_value[key]
64 except KeyError as e:
65 raise NotImplementedError(f"{key=}") from e
66 else:
67 raise KeyError(f"No flag key '{key}'")
68
69 def __setattr__(self, attr, value):
70 if attr.islower() and attr.upper() in FLAGS:

Callers 1

__getitem__Method · 0.45

Calls 1

keysMethod · 0.45

Tested by

no test coverage detected