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

Method setup_ex

caffe2/python/db_file_reader.py:127–147  ·  view source on GitHub ↗

From the Dataset, create a _DatasetReader and setup a init_net. Make sure the _init_field_blobs_as_empty(...) is only called once. Because the underlying NewRecord(...) creats blobs by calling NextScopedBlob(...), so that references to previously-initiated empty blo

(self, init_net, finish_net)

Source from the content-addressed store, hash-verified

125 return schema
126
127 def setup_ex(self, init_net, finish_net):
128 """From the Dataset, create a _DatasetReader and setup a init_net.
129
130 Make sure the _init_field_blobs_as_empty(...) is only called once.
131
132 Because the underlying NewRecord(...) creats blobs by calling
133 NextScopedBlob(...), so that references to previously-initiated
134 empty blobs will be lost, causing accessibility issue.
135 """
136 if self.ds_reader:
137 self.ds_reader.setup_ex(init_net, finish_net)
138 else:
139 self._init_field_blobs_as_empty(init_net)
140 self._feed_field_blobs_from_db_file(init_net)
141 self.ds_reader = self.ds.random_reader(
142 init_net,
143 batch_size=self.batch_size,
144 loop_over=self.loop_over,
145 )
146 self.ds_reader.sort_and_shuffle(init_net)
147 self.ds_reader.computeoffset(init_net)
148
149 def read(self, read_net):
150 assert self.ds_reader, 'setup_ex must be called first'

Callers

nothing calls this directly

Calls 5

random_readerMethod · 0.80
sort_and_shuffleMethod · 0.80
computeoffsetMethod · 0.80

Tested by

no test coverage detected