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

Function FeedRecord

caffe2/python/schema.py:1163–1186  ·  view source on GitHub ↗

Given a Record containing blob_references and arrays, which is either a list of numpy arrays or a Record containing numpy arrays, feeds the record to the current workspace.

(blob_record, arrays, ws=None)

Source from the content-addressed store, hash-verified

1161
1162
1163def FeedRecord(blob_record, arrays, ws=None):
1164 """
1165 Given a Record containing blob_references and arrays, which is either
1166 a list of numpy arrays or a Record containing numpy arrays, feeds the
1167 record to the current workspace.
1168 """
1169
1170 def feed(b, v):
1171 if ws is None:
1172 workspace.FeedBlob(str(b), v)
1173 else:
1174 ws.create_blob(str(b))
1175 ws.blobs[str(b)].feed(v)
1176 assert isinstance(blob_record, Field)
1177 field_blobs = blob_record.field_blobs()
1178 assert all(isinstance(v, BlobReference) for v in field_blobs)
1179 if isinstance(arrays, Field):
1180 # TODO: check schema
1181 arrays = arrays.field_blobs()
1182 assert len(arrays) == len(field_blobs), (
1183 'Values must contain exactly %d ndarrays.' % len(field_blobs)
1184 )
1185 for blob, array in zip(field_blobs, arrays):
1186 feed(blob, array)
1187
1188
1189def NewRecord(net, schema):

Callers 6

test_dequeue_manyMethod · 0.90
test_local_sessionMethod · 0.90
make_source_datasetFunction · 0.90
test_pack_unpackMethod · 0.90
test_dataset_opsMethod · 0.90
test_record_queueMethod · 0.90

Calls 4

isinstanceFunction · 0.85
feedFunction · 0.85
allFunction · 0.50
field_blobsMethod · 0.45

Tested by 6

test_dequeue_manyMethod · 0.72
test_local_sessionMethod · 0.72
make_source_datasetFunction · 0.72
test_pack_unpackMethod · 0.72
test_dataset_opsMethod · 0.72
test_record_queueMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…