def read_info

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

import bendtorch-core@0.1.0.0/src/tensor/core.bend as Core
import Base
import bendtorch-core@0.1.0.0/src/storage/main.bend as Storage
import bendtorch-core@0.1.0.0/src/tensor/lifecycle.bend as Lifecycle

536def read_info(original: Dynamic, +index: U32) -> ReadInfo<original, index>:
537  Packed{+shape, tensor} = original
538  TTensor{storage, exact} = tensor
539  match storage:
540    case Storage.Empty{}:
541      ReadInfo{Packed{shape, TTensor{Storage.Empty{}, exact}}, {==},
542        dynamic_read_source(shape, TTensor{Storage.Empty{}, exact}, index,
543          storage_read_source(shape, Storage.Empty{}, exact, index, Lifecycle.StorageReadModel{{==}})),
544        dynamic_read_keeps_source(shape, TTensor{Storage.Empty{}, exact}, index,
545          storage_read_keeps_source(shape, Storage.Empty{}, exact, index, Lifecycle.StorageReadKeeps{other => {==}}))}
546    case Storage.Owned{+depth, +length, array, balanced, valid}:
547      ReadInfo{Packed{shape, TTensor{Storage.Owned{depth, length, array, balanced, valid}, exact}}, {==},
548        dynamic_read_source(shape, TTensor{Storage.Owned{depth, length, array, balanced, valid}, exact}, index,
549          owned_read_source(shape, depth, length, array, index, balanced, valid, exact)),
550        dynamic_read_keeps_source(shape, TTensor{Storage.Owned{depth, length, array, balanced, valid}, exact}, index,
551          owned_read_keeps(shape, depth, length, array, index, balanced, valid, exact))}

Uses (13)

Used by (0)

No other definition uses this definition.