MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / __init__

Method __init__

python/oneflow/test/graph/test_graph_pipeline.py:201–216  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

199def _train_with_module(iter_num=3, data=None):
200 class DataModule(flow.nn.Module):
201 def __init__(self, data):
202 super().__init__()
203 self.data_list = []
204 self.idx = 0
205 for pair in data:
206 for i in range(4):
207 s = i * 4
208 e = s + 4
209 micro_batch_image = pair[0][s:e]
210 micro_batch_label = pair[1][s:e]
211 self.data_list.append(
212 (
213 flow.Tensor(micro_batch_image).to("cuda:3"),
214 flow.Tensor(micro_batch_label).to("cuda:3"),
215 )
216 )
217
218 def forward(self):
219 image = self.data_list[self.idx][0]

Callers 5

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

appendMethod · 0.45
toMethod · 0.45
TensorMethod · 0.45

Tested by

no test coverage detected