| 232 | |
| 233 | template <typename Op, typename Executor> |
| 234 | auto OpToTensor(Op &&op, [[maybe_unused]] const Executor &exec) { |
| 235 | if constexpr (is_matx_transform_op<Op>()) { |
| 236 | // We can assume that if a transform is passed to the input then PreRun has already completed |
| 237 | // on the transform and we can use the internal pointer |
| 238 | return make_tensor<typename Op::value_type>(op.Data(), Shape(op)); |
| 239 | } |
| 240 | else if constexpr (!is_tensor_view_v<Op>) { |
| 241 | if constexpr (is_cuda_executor_v<Executor>) { |
| 242 | return make_tensor<typename remove_cvref<Op>::value_type>(op.Shape(), MATX_ASYNC_DEVICE_MEMORY, exec.getStream()); |
| 243 | } else { |
| 244 | return make_tensor<typename remove_cvref<Op>::value_type>(op.Shape(), MATX_HOST_MALLOC_MEMORY); |
| 245 | } |
| 246 | } else { |
| 247 | return op; |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Get a transposed view of a tensor or operator into a user-supplied buffer |
no test coverage detected