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

Function _Blob_feed

caffe2/python/workspace.py:745–757  ·  view source on GitHub ↗
(blob, arg, device_option=None)

Source from the content-addressed store, hash-verified

743
744
745def _Blob_feed(blob, arg, device_option=None):
746 # conservative type check to avoid unnecessary import
747 if type(arg).__name__ == 'Tensor' and type(arg).__module__ == 'torch':
748 import torch
749 if isinstance(arg, torch.Tensor):
750 assert device_option is None, \
751 "device_option doesn't make sense with PyTorch tensors"
752 handle = torch._C._tensor_impl_raw_handle(arg)
753 blob._wrap_tensor_impl(handle)
754 return True # _feed() returns True for some reason
755 if device_option is not None:
756 device_option = StringifyProto(device_option)
757 return blob._feed(arg, device_option)
758
759
760C.Blob.feed = _Blob_feed

Callers

nothing calls this directly

Calls 2

isinstanceFunction · 0.85
StringifyProtoFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…