def reshape_equal

bendtorch-core@0.1.0.0 · src/tensor/transforms.bend:24

import bendtorch-core@0.1.0.0/src/tensor/transforms.bend as Transforms
import Base
import bendtorch-core@0.1.0.0/src/shape/core.bend as Shape
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

24def reshape_equal(-input: Shape.Shape, +target: Shape.Shape, tensor: Core.Tensor<input>,
25  -same: {Shape.logical_numel(Shape.dimensions(input)) == Shape.logical_numel(Shape.dimensions(target)) : Nat}) -> Core.Dynamic:
26  Core.TTensor{storage, valid} = tensor
27  Core.pack(target, Core.TTensor{storage,
28    Equal.trans(Nat, Lifecycle.logical_length(storage), Shape.logical_numel(Shape.dimensions(input)),
29      Shape.logical_numel(Shape.dimensions(target)), valid, same)})

Uses (9)

Used by (8)