| 126 | |
| 127 | template <typename T> |
| 128 | void validate_static_cast(const TensorShape &shape, DataType src_dtype, DataType dst_dtype) |
| 129 | { |
| 130 | Tensor input = create_tensor<Tensor>(shape, src_dtype, 1); |
| 131 | Tensor output = create_tensor<Tensor>(shape, dst_dtype, 1); |
| 132 | |
| 133 | NECast cast; |
| 134 | cast.configure(&input, &output, ConvertPolicy::SATURATE); |
| 135 | input.allocator()->allocate(); |
| 136 | output.allocator()->allocate(); |
| 137 | |
| 138 | library->fill_tensor_value(Accessor(input), 1.99f); |
| 139 | cast.run(); |
| 140 | |
| 141 | for (unsigned int i = 0; i < shape.x(); ++i) |
| 142 | { |
| 143 | const T ref = 1; |
| 144 | const T target = reinterpret_cast<T *>(output.buffer())[i]; |
| 145 | |
| 146 | ARM_COMPUTE_EXPECT(ref == target, framework::LogLevel::ERRORS); |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | } // namespace |
| 151 | |