def copy

stelliferous@0.0.2.0 · tensor_operations.bend:43

import stelliferous@0.0.2.0/tensor_operations.bend as TensorOperations
import Base
import stelliferous@0.0.2.0/storage_buffer.bend as Storage
import stelliferous@0.0.2.0/tensor_shape.bend as Shapes
import stelliferous@0.0.2.0/tensor_view.bend as Views
import stelliferous@0.0.2.0/proofs/storage_certificate.bend as Certificate

43def copy(~Element: Data,input: Storage.Buffer<Element>,+source: Views.View,
44  output: Storage.Buffer<Element>,+target: Views.View) -> Outcome<(Storage.Buffer<Element> & Storage.Buffer<Element>)>:
45  Storage.Buffer{input,+input_length,input_certificate} = input
46  Certificate.Certificate{+input_depth,input_equation} = input_certificate
47  Storage.Buffer{output,+output_length,output_certificate} = output
48  Certificate.Certificate{+output_depth,output_equation} = output_certificate
49  copy_when(~Element,Shapes.same(Views.shape(source),Views.shape(target)) && Views.is_contiguous(target) &&
50    valid_buffer(input_length,U32.shln(1,input_depth),source) &&
51    valid_buffer(output_length,U32.shln(1,output_depth),target),Views.numel(target),source,target,
52    Storage.Buffer{input,input_length,Certificate.Certificate{input_depth,input_equation}},Storage.Buffer{output,output_length,Certificate.Certificate{output_depth,output_equation}})

Uses (13)

Used by (2)