def gather_status

stelliferous@0.0.2.0 · tensor_layout.bend:43

import stelliferous@0.0.2.0/tensor_layout.bend as TensorLayout
import Base
import stelliferous@0.0.2.0/storage_buffer.bend as Storage
import stelliferous@0.0.2.0/tensor_view.bend as Views
import stelliferous@0.0.2.0/tensor.bend as Tensors

43# Copy the elements selected by source_view, in its row-major order, into a
44# new tensor whose storage is laid out as view_shape and labelled target_shape.
45def gather_status(~Element: Data,name: String,status: Tensors.Status,source_view: Maybe<&2,Views.View>,+view_shape: List<&2,U32>,
46  +target_shape: List<&2,U32>,input: Storage.Buffer<Element>,+source_shape: List<&2,U32>,+fill: Element,+workers: U32) ->
47  Tensors.Tensor<Element> & Tensors.Tensor<Element>:
48  match status:
49    case Tensors.Usable{}:
50      gather_views(~Element,name,source_view,Tensors.view_of(view_shape),Tensors.count_of(view_shape),input,source_shape,target_shape,fill,workers)
51    case Tensors.Failed{+problem}:
52      (Tensors.Tensor{Tensors.buffer(~Element,fill,0),target_shape,fill,Tensors.Failed{problem},workers},
53        Tensors.Tensor{input,source_shape,fill,Tensors.Failed{problem},workers})

Uses (14)

Used by (6)