TensorOperations.scatter_when: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/tensor_operations.bend as TensorOperations Lines 54-66 of stelliferous@0.0.2.0/tensor_operations.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/tensor_operations.bend&start_line=54&end_line=66 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_access.bend as Access import stelliferous@0.0.2.0/proofs/tensor_access_certificate.bend as AccessCertificate # output[address of element i of target] = input[offset of source + i]: a # contiguous source written through a strided target view, in row-major order. def scatter_when(~Element: Data,valid: Bool,count: Maybe<&2,U32>,source: Views.View,+target: Views.View, input: Storage.Buffer,output: Storage.Buffer) -> Outcome<(Storage.Buffer & Storage.Buffer)>: match valid count: case True{} Some{+count}: Views.View{axes,+offset} = source Storage.Buffer{input,input_length,input_certificate} = input Storage.Buffer{output,output_length,output_certificate} = output Accepted{pair_buffers(~Element,input_length,output_length, Access.scatter_run(~Element,U32.to_nat(count),target,offset,input,output), AccessCertificate.scatter(~Element,U32.to_nat(count),target,offset,input,output,input_certificate,output_certificate))} case valid count: Rejected{(input,output)} Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/proofs/tensor_access_certificate.bend&name=scatter https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/storage_buffer.bend&name=Buffer https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_access.bend&name=scatter_run https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_operations.bend&name=Outcome https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_operations.bend&name=pair_buffers https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_view.bend&name=View