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

Method set_value

caffe2/python/schema.py:787–793  ·  view source on GitHub ↗

Sets only the blob field still validating the existing dtype

(self, blob, throw_on_type_mismatch=False, unsafe=False)

Source from the content-addressed store, hash-verified

785 "fields but got {}".format(self.dtype)
786
787 def set_value(self, blob, throw_on_type_mismatch=False, unsafe=False):
788 """Sets only the blob field still validating the existing dtype"""
789 if self.dtype.base != np.void and throw_on_type_mismatch:
790 assert isinstance(blob, np.ndarray), "Got {!r}".format(blob)
791 assert blob.dtype.base == self.dtype.base, (
792 "Expected {}, got {}".format(self.dtype.base, blob.dtype.base))
793 self.set(dtype=self._original_dtype, blob=blob, unsafe=unsafe)
794
795 def set(self, dtype=None, blob=None, metadata=None, unsafe=False):
796 """Set the type and/or blob of this scalar. See __init__ for details.

Callers 3

from_blob_listFunction · 0.45
NewRecordFunction · 0.45
__init__Method · 0.45

Calls 3

setMethod · 0.95
isinstanceFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected