| 350 | */ |
| 351 | template <typename T> |
| 352 | void init_tensor(T &tensor, arm_compute::DataType dt) |
| 353 | { |
| 354 | ARM_COMPUTE_ERROR_ON(!is_open()); |
| 355 | ARM_COMPUTE_ERROR_ON(dt != arm_compute::DataType::F32); |
| 356 | |
| 357 | // Use the size of the input NPY tensor |
| 358 | TensorShape shape; |
| 359 | shape.set_num_dimensions(_shape.size()); |
| 360 | for (size_t i = 0; i < _shape.size(); ++i) |
| 361 | { |
| 362 | size_t src = i; |
| 363 | if (_fortran_order) |
| 364 | { |
| 365 | src = _shape.size() - 1 - i; |
| 366 | } |
| 367 | shape.set(i, _shape.at(src)); |
| 368 | } |
| 369 | |
| 370 | arm_compute::TensorInfo tensor_info(shape, 1, dt); |
| 371 | tensor.allocator()->init(tensor_info); |
| 372 | } |
| 373 | |
| 374 | /** Fill a tensor with the content of the currently open NPY file. |
| 375 | * |
nothing calls this directly
no test coverage detected