()
| 1170 | |
| 1171 | |
| 1172 | def test_python_formats(): |
| 1173 | class TestPipeline(Pipeline): |
| 1174 | def __init__(self, batch_size, num_threads, device_id, num_gpus, test_array): |
| 1175 | super(TestPipeline, self).__init__(batch_size, num_threads, device_id) |
| 1176 | self.input_data = ops.ExternalSource() |
| 1177 | self.test_array = test_array |
| 1178 | |
| 1179 | def define_graph(self): |
| 1180 | self.data = self.input_data() |
| 1181 | return self.data |
| 1182 | |
| 1183 | def iter_setup(self): |
| 1184 | self.feed_input(self.data, self.test_array) |
| 1185 | |
| 1186 | for t in [ |
| 1187 | np.bool_, |
| 1188 | np.int_, |
| 1189 | np.intc, |
| 1190 | np.intp, |
| 1191 | np.int8, |
| 1192 | np.int16, |
| 1193 | np.int32, |
| 1194 | np.int64, |
| 1195 | np.uint8, |
| 1196 | np.uint16, |
| 1197 | np.uint32, |
| 1198 | np.uint64, |
| 1199 | np.float32, |
| 1200 | np.float16, |
| 1201 | np.short, |
| 1202 | int, |
| 1203 | np.longlong, |
| 1204 | np.ushort, |
| 1205 | np.ulonglong, |
| 1206 | ]: |
| 1207 | test_array = np.array([[1, 1], [1, 1]], dtype=t) |
| 1208 | pipe = TestPipeline(2, 1, 0, 1, test_array) |
| 1209 | out = pipe.run()[0] |
| 1210 | out_dtype = out.at(0).dtype |
| 1211 | assert test_array.dtype.itemsize == out_dtype.itemsize |
| 1212 | assert test_array.dtype.str == out_dtype.str |
| 1213 | |
| 1214 | |
| 1215 | def test_api_check1(): |
nothing calls this directly
no test coverage detected