MCPcopy Create free account
hub / github.com/NVIDIA/DALI / test_api_check1

Function test_api_check1

dali/test/python/test_pipeline.py:1215–1243  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1213
1214
1215def 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
1246def test_api_check2():

Callers

nothing calls this directly

Calls 4

assert_raisesFunction · 0.90
enable_api_checkMethod · 0.80
TestPipelineClass · 0.70
runMethod · 0.45

Tested by

no test coverage detected