def reshaped_value

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

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
import bendtorch-core@0.1.0.0/src/tensor/transform_observation.bend as Observation

92def reshaped_value(+input: Shape.Shape, +target: Shape.Shape, storage: Storage.Storage,
93  -valid: {Lifecycle.logical_length(storage) == Shape.logical_numel(Shape.dimensions(input)) : Nat}, +other: U32, +same: {Shape.logical_numel(Shape.dimensions(input)) == Shape.logical_numel(Shape.dimensions(target)) : Nat}) ->
94  {Observation.output_value(other, Transforms.reshape(input, Core.TTensor{storage, valid}, Shape.dimensions(target))) ==
95    Lifecycle.read_value(Storage.get(storage, other)) : Maybe<&2, F32>}:
96  reshape_lift(input, target, storage, valid, same,
97    result => {Observation.output_value(other, result) == Lifecycle.read_value(Storage.get(storage, other)) : Maybe<&2, F32>},
98    output => preserved => fits => dynamic_value(output, storage, fits, other, Storage.get(storage, other), {==}))

Uses (16)

Used by (2)