MCPcopy Index your code
hub / github.com/pytorch/pytorch / _normalize_field

Function _normalize_field

caffe2/python/schema.py:48–55  ·  view source on GitHub ↗

Clones/normalizes a field before adding it to a container.

(field_or_type_or_blob, keep_blobs=True)

Source from the content-addressed store, hash-verified

46
47
48def _normalize_field(field_or_type_or_blob, keep_blobs=True):
49 """Clones/normalizes a field before adding it to a container."""
50 if isinstance(field_or_type_or_blob, Field):
51 return field_or_type_or_blob.clone(keep_blobs=keep_blobs)
52 elif type(field_or_type_or_blob) in (type, np.dtype):
53 return Scalar(dtype=field_or_type_or_blob)
54 else:
55 return Scalar(blob=field_or_type_or_blob)
56
57
58FeatureSpec = namedtuple(

Callers 7

__init__Method · 0.85
cloneMethod · 0.85
__init__Method · 0.85
cloneMethod · 0.85
__init__Method · 0.85
cloneMethod · 0.85
as_recordFunction · 0.85

Calls 3

isinstanceFunction · 0.85
ScalarClass · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…