def take_owned
bendtorch-core@0.1.0.0 · src/tensor/elementwise.bend:449
import bendtorch-core@0.1.0.0/src/tensor/elementwise.bend as Elementwise
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/storage/model.bend as Model
import bendtorch-core@0.1.0.0/src/storage/certificates.bend as Certificates
import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
449
450
451def take_owned(+shape: Shape.Shape, +depth: Nat, +length: Nat, -array: Array<F32>,
452 pair: Array<F32> & Array<F32>, -same: {pair == Array.clone(F32, array) : Array<F32> & Array<F32>},
453 -balanced: Model.Balanced(F32, depth, array), -valid: {Storage.bounds(depth, length) == True{} : Bool},
454 -exact: {length == Shape.logical_numel(Shape.dimensions(shape)) : Nat}) -> Core.Dynamic & Array<F32>:
455 (kept, copy) = pair
456 (Core.Packed{shape, Core.TTensor{Storage.Owned{depth, length, kept,
457 Certificates.clone_first(F32, depth, array, (kept, copy), same, balanced), valid}, exact}}, copy)