TensorLayout.pad_constant: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/tensor_layout.bend as TensorLayout Lines 527-540 of stelliferous@0.0.2.0/tensor_layout.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/tensor_layout.bend&start_line=527&end_line=540 import Base import stelliferous@0.0.2.0/tensor.bend as Tensors # Constant padding: storage of the padded extents filled with the value, then # the tensor written through the interior view. One copy whatever the axes. def pad_constant(~Element: Data,unchanged: Bool,+value: Element,tensor: Tensors.Tensor,+before: List<&2,U32>,+padded: List<&2,U32>) -> Tensors.Tensor: match unchanged: case True{}: tensor case False{}: Tensors.with_dense(~Element,~Tensors.Tensor,tensor,part => part_shape => part_fill => part_status => part_workers => +part_shape = part_shape +part_fill = part_fill +part_workers = part_workers Tensors.with_dense(~Element,~Tensors.Tensor,blank(~Element,Tensors.count_of(padded),padded,value,part_fill,part_workers), target => target_shape => target_fill => target_status => target_workers => result_of(~Element,place_status(~Element,"pad",target_status,part_status,interior(before,part_shape,Tensors.view_of(padded),0), target,padded,target_fill,part,part_shape,part_fill,part_workers)))) Uses (11): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor.bend&name=Tensor https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor.bend&name=count_of https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor.bend&name=view_of https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor.bend&name=with_dense https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_layout.bend&name=blank https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_layout.bend&name=interior https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_layout.bend&name=place_status https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_layout.bend&name=result_of