| 84 | |
| 85 | |
| 86 | class PythonOperatorPipeline(CommonPipeline): |
| 87 | def __init__( |
| 88 | self, batch_size, num_threads, device_id, seed, image_dir, function, prefetch_queue_depth=2 |
| 89 | ): |
| 90 | super().__init__( |
| 91 | batch_size, |
| 92 | num_threads, |
| 93 | device_id, |
| 94 | seed, |
| 95 | image_dir, |
| 96 | prefetch_queue_depth=prefetch_queue_depth, |
| 97 | ) |
| 98 | self.python_function = ops.PythonFunction(function=function) |
| 99 | |
| 100 | def define_graph(self): |
| 101 | images, labels = self.load() |
| 102 | processed = self.python_function(images) |
| 103 | assert isinstance(processed, _DataNode) |
| 104 | return processed |
| 105 | |
| 106 | |
| 107 | class FlippingPipeline(CommonPipeline): |
no outgoing calls