def reshape_lift

bendtorch-core@0.1.0.0 · src/tensor/reshape_contract.bend:73

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/main.bend as Storage
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle
import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms

73def reshape_lift(+input: Shape.Shape, +target: Shape.Shape, -storage: Storage.Storage,
74  -valid: {Lifecycle.logical_length(storage) == Shape.logical_numel(Shape.dimensions(input)) : Nat}, +same: {Shape.logical_numel(Shape.dimensions(input)) == Shape.logical_numel(Shape.dimensions(target)) : Nat}, -P: Result<&2, &1, Transforms.Error, Core.Dynamic> -> Type,
75  h: @+output: Shape.Shape -> @preserved: {Shape.dimensions(output) == Shape.dimensions(target) : List<&2, U32>} ->
76    @-fits: {Lifecycle.logical_length(storage) == Shape.logical_numel(Shape.dimensions(output)) : Nat} -> P(Done{Core.Packed{output, Core.TTensor{storage, fits}}})) ->
77  P(Transforms.reshape(input, Core.TTensor{storage, valid}, Shape.dimensions(target))):
78  built_lift(input, target, storage, valid, Shape.construct(Shape.dimensions(target)), shape_complete(target), same, P, h)

Uses (16)

Used by (5)