TypeTensor - v0.1.0
    Preparing search index...

    Module @typetensor/core

    @typetensor/core

    npm version

    Core tensor operations with compile-time type safety for TypeScript

    Part of TypeTensor

    npm install @typetensor/core
    

    Key Features:

    • Compile-time shape validation using TypeScript's type system
    • NumPy-compatible broadcasting and operations
    • Einstein notation (einops) for tensor transformations
    • Full numeric type system with automatic promotion
    • Zero runtime overhead for type checking

    Core Operations:

    • Tensor creation, arithmetic, and linear algebra
    • Shape manipulation: reshape, transpose, slice, permute
    • Reductions: sum, mean, max, min along axes
    • Activation functions: softmax, log-softmax

    See examples →

    MIT

    Classes

    AlignmentError
    BinaryBroadcaster
    BoundsError
    BroadcastManager
    ConversionError
    DTypeBufferError
    DTypeErrorClass
    DTypeValidationError
    LayerShapeResolver
    OverflowError
    PrecisionLossError
    ReductionBroadcaster
    RuntimeDType
    RuntimeShape
    Tensor
    TypedArrayError

    Interfaces

    ConversionOptions
    DefaultLayoutFlags
    Device
    DeviceData
    DimensionError
    DType
    DTypedArray
    LayoutFlags
    PrecisionLossInfo
    RearrangeOptions
    ShapeError
    StorageTransformation
    SymbolicDim
    TensorOptions
    TensorStorage

    Type Aliases

    Abs
    Add
    AllButLast
    AllOperationTypes
    AnyDType
    AnyStorageTransformation
    AnyTensorStorage
    ArrayConstructorOf
    At
    AttentionShape
    AttentionSoftmax
    BatchDims
    BatchShape
    BigIntDTypes
    BinaryOp
    Bool
    BroadcastShapes
    ByteSizeOf
    CanBroadcast
    CanMatmul
    CanPromote
    CanReshape
    CanSafelyCast
    ComputeSlicedStrides
    ComputeStrides
    Concat
    ConversionResult
    Cos
    CreateOp
    DefaultBoolDType
    DefaultDType
    DefaultIntDType
    Div
    Drop
    DTypeFromName
    DTypeName
    DTypeNameOf
    DTypeOf
    DTypeValue
    DynamicShape
    Equals
    Exp
    Flatten
    FlattenArray
    Float32
    Float64
    FloatDTypes
    GlobalMax
    GlobalMean
    GlobalMin
    GlobalSum
    HasMatchingInnerDims
    ImageShape
    IncompatibleDTypesError
    IncompatibleShapes
    InferShape
    Init
    Int16
    Int32
    Int64
    Int8
    IntegerDTypes
    InvalidCastError
    IsAssignableTo
    IsEmpty
    IsFloatDType
    IsIntegerDType
    IsLossyCast
    IsMatMulCompatible
    IsSignedDType
    JSTypeOf
    Last
    LastDim
    LayoutOf
    Length
    Log
    LogSoftmax
    LogSoftmaxLastDim
    LogSoftmaxOp
    Matmul
    MatmulOp
    MatMulShape
    Max
    MaxBatch
    MaxLastDim
    MaxOp
    Mean
    MeanBatch
    MeanLastDim
    MeanOp
    Min
    MinBatch
    MinLastDim
    MinOp
    Mul
    Neg
    NestedArray
    NormalizeDim
    NumberDTypes
    OutputOf
    PartialShape
    Permute
    PermuteOp
    Product
    Promote
    RearrangeOp
    ReduceShape
    Reshape
    ReshapeOp
    ResolvedShape
    Reverse
    SecondToLast
    SequenceShape
    Shape
    Shape1D
    Shape2D
    Shape3D
    Shape4D
    ShapeMismatchError
    ShapeOf
    ShapeToString
    SignedDTypes
    Sin
    SliceIndex
    SliceOp
    Softmax
    SoftmaxLastDim
    SoftmaxOp
    Sqrt
    Square
    Squeeze
    StridesOf
    Sub
    Sum
    SumBatch
    SumLastDim
    SumOp
    SymbolicShape
    Tail
    Take
    Transpose
    TransposeOp
    TupleOf
    TypedArrayConstructor
    Uint16
    Uint32
    Uint64
    Uint8
    UnaryOp
    UnsignedDTypes
    Unsqueeze
    ValidateAxes
    ValidateDeviceOperations
    ValidateDim
    ValidateReduction
    View

    Variables

    bool
    CommonDTypes
    DTYPE_CONSTANTS_MAP
    DTypeConstants
    DTYPES
    float32
    float64
    int16
    int32
    int64
    int8
    MAX_TENSOR_RANK
    MAX_TENSOR_SIZE
    PERMISSIVE_CONVERSION_OPTIONS
    SCALAR_SHAPE
    SHAPE_PATTERNS
    STRICT_CONVERSION_OPTIONS
    uint16
    uint32
    uint64
    uint8

    Functions

    analyzePromotion
    assertExhaustiveSwitch
    assertMatmulCompatible
    assertShapesCompatible
    assertValidShape
    broadcastBinaryOp
    broadcastShapes
    bufferToNestedArray
    calculateByteSize
    calculateMemoryUsage
    canBroadcast
    canMatmul
    canPromoteTypes
    computeResultType
    computeUnaryResultType
    convertArray
    convertTypedArray
    convertValue
    copyTypedArrayData
    createAlignedBuffer
    createInferredArray
    createReadonlyTypedArray
    createShape
    createTypedArray
    createTypedArrayFromBuffer
    createTypedArrayFromData
    createTypedArrayView
    eye
    findCommonType
    formatShape
    getAlignedOffset
    getDefaultDType
    getDType
    getDTypeConstant
    getDTypeNames
    getDTypeSystemInfo
    getPromotionRules
    getTypedArrayDType
    hasMemoryOverlap
    hasSymbolicDimensions
    inferShape
    isAligned
    isRuntimeDType
    isStaticShape
    isValidDTypeName
    isValidShape
    matmulShape
    nestedArrayToBuffer
    ones
    promoteMultipleTypes
    promoteTypes
    rearrange
    reshape
    resolveSymbolicShape
    safeCast
    sharesSameBuffer
    tensor
    toFloatDType
    toPromotedDType
    unsafeCast
    validateArrayData
    validateBufferSize
    validateDTypeSystem
    validatePromotionMatrix
    validateTypedArray
    validateTypedArrayDType
    wouldBeLossy
    wrapTypedArray
    zeros