strata::Scratch¶
Part of Evaluation and assignment.
E itself, and where an evaluation takes the memory of its buffers from.
Memory is a policy or an allocator as a tensor takes, for the buffers of E and of everything under it, up to a Scratch of its own. Read, sliced and walked as E is. Where nothing under it is worth a buffer, the memory goes unused, which is no error: whether a part is buffered is the cost model's call, and may change. Made by scratch.
A slice, a permutation or a block of it is the same operation on E with the same memory, which keeps E as its own view operations give it. For one that can be copied; a Scratch that holds a temporary owner is cut by the nodes of slice, permute and block.
Template parameters
| Name | Description |
|---|---|
E | The expression or view evaluated, as it is held. |
Memory | A memory policy or an allocator. |
Members¶
Scratch¶
Wraps operand together with the memory its buffers come from.
operand¶
The wrapped expression.
memory¶
The policy or allocator the buffers take their memory from.
shape¶
The shape of the operand.
cursor¶
A cursor over the operand's values.
operator[]¶
The operand's element at indices.
slice¶
template <std::size_t... Axes>
constexpr auto slice(const Scratch &scratch, const std::array<std::size_t, sizeof...(Axes)> &indices)
The slice of the operand, with the same memory.
permute¶
The permutation of the operand, with the same memory.
block¶
template <Extent... Sizes>
constexpr auto block(const Scratch &scratch, const Shape<Sizes...> &sizes, const std::array<std::size_t, sizeof...(Sizes)> &corner)
The block of the operand, with the same memory.