def reshape_count_mismatch
bendtorch-core@0.1.0.0 · src/tensor/reshape_contract.bend:232
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/layout.bend as Layout
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
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
232def reshape_count_mismatch(+input: Shape.Shape, +fill: F32, +target: Shape.Shape,
233 different: {Nat.is_eq(Shape.logical_numel(Shape.dimensions(input)), Shape.logical_numel(Shape.dimensions(target))) == False{} : Bool}) ->
234 {Observation.reshape_code(input, Shape.dimensions(target), Core.new(input, fill)) == Some{15} : Maybe<&2, U32>}:
235 +different = different
236 Reads.new_lift(input, fill, result => {Observation.reshape_code(input, Shape.dimensions(target), result) == Some{15} : Maybe<&2, U32>},
237 valid => Equal.cong(Result<&2, &1, Transforms.Error, Core.Dynamic>, Maybe<&2, U32>, result => Some{Observation.status(result)},
238 Transforms.reshape(input, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, Shape.dimensions(target)), Fail{Transforms.LayoutError{Layout.ElementCountMismatch{}}},
239 mismatch_built(input, target, Core.TTensor{StorageLaws.created(Shape.count(input), fill), valid}, Shape.construct(Shape.dimensions(target)), shape_complete(target), different)))