| 1287 | |
| 1288 | |
| 1289 | def test_separated_exec_setup(): |
| 1290 | batch_size = 128 |
| 1291 | pipe = Pipeline( |
| 1292 | batch_size=batch_size, |
| 1293 | num_threads=3, |
| 1294 | device_id=None, |
| 1295 | prefetch_queue_depth={"cpu_size": 5, "gpu_size": 3}, |
| 1296 | ) |
| 1297 | inputs, labels = fn.readers.caffe(path=caffe_dir, shard_id=0, num_shards=1) |
| 1298 | images = fn.decoders.image(inputs, output_type=types.RGB) |
| 1299 | images = fn.resize(images, resize_x=224, resize_y=224) |
| 1300 | images_cpu = fn.dump_image(images, suffix="cpu") |
| 1301 | pipe.set_outputs(images, images_cpu) |
| 1302 | |
| 1303 | out = pipe.run() |
| 1304 | assert out[0].is_dense_tensor() |
| 1305 | assert out[1].is_dense_tensor() |
| 1306 | assert out[0].as_tensor().shape() == out[1].as_tensor().shape() |
| 1307 | a_raw = out[0] |
| 1308 | a_cpu = out[1] |
| 1309 | for i in range(batch_size): |
| 1310 | t_raw = a_raw.at(i) |
| 1311 | t_cpu = a_cpu.at(i) |
| 1312 | assert np.sum(np.abs(t_cpu - t_raw)) == 0 |
| 1313 | |
| 1314 | |
| 1315 | def test_tensor_subscript(): |