MCPcopy Create free account
hub / github.com/NVIDIA/MatX / OpToTensor

Function OpToTensor

include/matx/core/tensor_utils.h:234–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 9

lu_implFunction · 0.85
lu_implFunction · 0.85
eig_implFunction · 0.85
eig_implFunction · 0.85
qr_solver_implFunction · 0.85
qr_solver_implFunction · 0.85
qr_econ_implFunction · 0.85
chol_implFunction · 0.85
chol_implFunction · 0.85

Calls 4

DataMethod · 0.80
ShapeMethod · 0.80
getStreamMethod · 0.80
ShapeFunction · 0.70

Tested by

no test coverage detected