def reshape_dimensions
bendtorch-core@0.1.0.0 · src/tensor/reshape_contract.bend:107
import bendtorch-core@0.1.0.0/src/tensor/reshape_contract.bend as ReshapeContract
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
import bendtorch-core@0.1.0.0/src/storage/LAWS.bend as StorageLaws
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/read_contract.bend as Reads
import bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend as Observation
107def reshape_dimensions(+input: Shape.Shape, +fill: F32, +target: Shape.Shape, +same: {Shape.logical_numel(Shape.dimensions(input)) == Shape.logical_numel(Shape.dimensions(target)) : Nat}) ->
108 {Observation.reshape_dimensions(input, Shape.dimensions(target), Core.new(input, fill)) == Some{Shape.dimensions(target)} : Maybe<&2, List<&2, U32>>}:
109 Reads.new_lift(input, fill, result => {Observation.reshape_dimensions(input, Shape.dimensions(target), result) == Some{Shape.dimensions(target)} : Maybe<&2, List<&2, U32>>},
110 valid => reshape_lift(input, target, StorageLaws.created(Shape.count(input), fill), valid, same,
111 result => {Observation.output_dimensions(result) == Some{Shape.dimensions(target)} : Maybe<&2, List<&2, U32>>},
112 output => preserved => fits => Equal.cong(List<&2, U32>, Maybe<&2, List<&2, U32>>, dims => Some{dims}, Shape.dimensions(output), Shape.dimensions(target), preserved)))