at

Contents

at#

Selects a single value from an operator. Since at is a lazily-evaluated operator, it should be used in situations where operator() cannot be used. For instance:

(a = b(5)).run();

The code above creates a race condition where b(5) is evaluated on the host before launch, but the value may not be computed from a previous operation. Instead, the at() operator can be used to defer the load until the operation is launched:

(a = at(b, 5)).run();
template<typename Op, typename ...Is>
__MATX_INLINE__ auto matx::at(const Op &op, Is... indices)#

Examples#

auto t1 = make_tensor<TestType>({10});
auto t0 = make_tensor<TestType>({});

t1.SetVals({10, 20, 30, 40, 50, 60, 70, 80, 90, 100});
(t2 = t1).run(exec);

// Select the fourth element from `t1` as part of the execution. Value should match 
// `t1(3)` after execution
(t0 = at(t1, 3)).run(exec);