def combine_stretched_with

stelliferous@0.0.2.0 · tensor.bend:291

import stelliferous@0.0.2.0/tensor.bend as Tensor
import Base
import stelliferous@0.0.2.0/storage_buffer.bend as Storage
import stelliferous@0.0.2.0/tensor_view.bend as Views

291# Operands of different extents with the common extents shape. When shape is
292# the left extents, only the right operand is stretched and the result reuses
293# the left storage. Otherwise the left operand is first copied through its
294# stretched view into new storage, which the right operand is combined into;
295# both steps run the innermost axis as one loop, which the three-buffer
296# combination with two cursors does not.
297def combine_stretched_with(~Element: Data,~kernel: @+count: Nat -> @+right_view: Views.View -> @+offset: U32 -> Storage.Buffer<Element> -> Storage.Buffer<Element> -> Storage.Buffer<Element> & Storage.Buffer<Element>,name: String,in_place: Bool,
298  left: Storage.Buffer<Element>,+left_shape: List<&2,U32>,+fill: Element,right: Storage.Buffer<Element>,+right_shape: List<&2,U32>,+shape: List<&2,U32>,+workers: U32) -> Tensor<Element>:
299  match in_place:
300    case True{}:
301      combine_views_with(~Element,~kernel,name,view_of(left_shape),stretched(view_of(right_shape),left_shape),left,left_shape,fill,right,right_shape,workers)
302    case False{}:
303      combine_fresh_views_with(~Element,~kernel,name,stretched(view_of(left_shape),shape),stretched(view_of(right_shape),shape),view_of(shape),view_of(shape),count_of(shape),
304        left,right,shape,fill,workers)

Uses (14)

Used by (1)