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

Method __init__

caffe2/python/schema.py:212–221  ·  view source on GitHub ↗
(self, values, lengths_blob=None)

Source from the content-addressed store, hash-verified

210 __slots__: Sequence[str] = ("lengths", "_items")
211
212 def __init__(self, values, lengths_blob=None):
213 if isinstance(lengths_blob, Field):
214 assert isinstance(lengths_blob, Scalar)
215 self.lengths = _normalize_field(lengths_blob)
216 else:
217 self.lengths = Scalar(np.int32, lengths_blob)
218 self._items = _normalize_field(values)
219 self.lengths._set_parent(self, 0)
220 self._items._set_parent(self, 1)
221 super().__init__([self.lengths, self._items])
222
223 def field_names(self):
224 value_fields = self._items.field_names()

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 4

isinstanceFunction · 0.85
_normalize_fieldFunction · 0.85
ScalarClass · 0.85
_set_parentMethod · 0.80

Tested by

no test coverage detected