()
| 1213 | |
| 1214 | |
| 1215 | def test_api_check1(): |
| 1216 | batch_size = 1 |
| 1217 | |
| 1218 | class TestPipeline(Pipeline): |
| 1219 | def __init__(self, batch_size, num_threads, device_id, num_gpus): |
| 1220 | super(TestPipeline, self).__init__(batch_size, num_threads, device_id) |
| 1221 | self.input = ops.readers.Caffe( |
| 1222 | path=caffe_db_folder, shard_id=device_id, num_shards=num_gpus |
| 1223 | ) |
| 1224 | |
| 1225 | def define_graph(self): |
| 1226 | inputs, labels = self.input(name="Reader") |
| 1227 | return inputs |
| 1228 | |
| 1229 | pipe = TestPipeline(batch_size=batch_size, num_threads=1, device_id=0, num_gpus=1) |
| 1230 | pipe.run() |
| 1231 | for method in [pipe.schedule_run, pipe.share_outputs, pipe.release_outputs, pipe.outputs]: |
| 1232 | with assert_raises( |
| 1233 | RuntimeError, |
| 1234 | glob=( |
| 1235 | "Mixing pipeline API type. Currently used: PipelineAPIType.BASIC," |
| 1236 | " but trying to use PipelineAPIType.SCHEDULED" |
| 1237 | ), |
| 1238 | ): |
| 1239 | method() |
| 1240 | # disable check |
| 1241 | pipe.enable_api_check(False) |
| 1242 | for method in [pipe.schedule_run, pipe.share_outputs, pipe.release_outputs, pipe.outputs]: |
| 1243 | method() |
| 1244 | |
| 1245 | |
| 1246 | def test_api_check2(): |
nothing calls this directly
no test coverage detected