StaticTensor

Usage

use StaticTensor;

or

import StaticTensor;
type tensor = staticTensor(?)
record staticTensor : serializable
param rank : int
type eltType = real(64)
var resource : shared(BaseTensorResource(eltType, rank))
proc meta
proc _dom
proc init(param rank: int, type eltType = real(64))
proc init(in resource: shared(BaseTensorResource(?eltType, ?rank)))
proc init(in resource: owned(BaseTensorResource(?eltType, ?rank)))
proc init(array: ndarray(?rank, ?eltType))
proc init(dom: domain(?), type eltType = real)
proc init(arr: [] ?eltType)
proc init(it: _iteratorRecord)
proc this(args ...)
proc reshapeDomain(dom: this._dom.type)
proc _setArrayData(value)
proc detach(copy: bool = true, keepGrad: bool = false) : staticTensor(rank, eltType)
operator :(in t: staticTensor(?rank, ?eltType), type toType) : staticTensor(rank, toType)
proc tensorFromCtx(param rank: int, type eltType, ctx) : staticTensor(rank, eltType)
operator +(a: staticTensor(?rank, ?eltType), b: staticTensor(rank, eltType))
operator -(a: staticTensor(?rank, ?eltType), b: staticTensor(rank, eltType))
operator *(a: staticTensor(?rank, ?eltType), b: staticTensor(rank, eltType))
operator /(a: staticTensor(?rank, ?eltType), b: staticTensor(rank, eltType))
proc staticTensor.reshape(dom: domain(?))
proc staticTensor.reshape(newShape: int ...?newRank)
proc staticTensor.relu()
proc staticTensor.permute(axes: int ...rank)
proc staticTensor.expand(axes: int ...rank)
proc staticTensor.pad(args: 2*int ...rank, value: eltType = 0.0)
proc staticTensor.shrink(args: 2*int ...rank)
proc staticTensor.slice(dom: domain(?))  where dom.rank == rank
proc staticTensor.slice(rngs: range ...rank)
proc staticTensor.sum(axes: int ...?r)
proc staticTensor.unsqueeze(dim: int) : staticTensor(rank+1, eltType)
proc staticTensor.max() : staticTensor(1, eltType)
proc staticTensor.exp() : staticTensor(rank, eltType)
proc staticTensor.softmax() : staticTensor(rank, eltType)
proc matvec(mat: staticTensor(2, ?eltType), vec: staticTensor(1, eltType)) : staticTensor(1, eltType)
proc matvec(mat: staticTensor(2, ?eltType), vec: staticTensor(2, eltType)) : staticTensor(2, eltType)
proc type staticTensor.matvecmul(m, v)
proc type staticTensor.convolve(features: staticTensor(3, ?eltType), kernel: staticTensor(4, eltType), stride: int) : staticTensor(3, eltType)
proc type staticTensor.convolve(features: staticTensor(3, ?eltType), kernel: staticTensor(4, eltType), bias: staticTensor(1, eltType), stride: int) : staticTensor(3, eltType)
proc type staticTensor.matvecmulFast(mat: staticTensor(2, ?eltType), vec: staticTensor(1, eltType)) : staticTensor(1, eltType)
proc staticTensor.dilate(dil: int) : staticTensor(3, eltType)  where this.rank == 3
proc staticTensor.maxPool(poolSize: int) : staticTensor(3, eltType)  where this.rank == 3
proc type staticTensor.arange(to: int, type eltType = real, shape: ?rank*int) : staticTensor(rank, eltType)
proc type staticTensor.arange(shape: int ...?rank) : staticTensor(rank, real)
proc type staticTensor.fromShape(type eltType = real, shape: int ...?rank, value: eltType = 0: eltType) : staticTensor(rank, eltType)
proc type staticTensor.zeros(shape: int ...?rank) : staticTensor(rank, real)
proc type staticTensor.zeros(type eltType, shape: int ...?rank) : staticTensor(rank, eltType)
proc type staticTensor.ones(shape: int ...?rank) : staticTensor(rank, real)
proc type staticTensor.ones(type eltType, shape: int ...?rank) : staticTensor(rank, eltType)
config const n = 100
config const diag = false
config const size = 3
proc main()
proc staticTensor.serialize(writer: IO.fileWriter(locking = false, IO.defaultSerializer), ref serializer: IO.defaultSerializer)
proc staticTensor.serialize(writer: IO.fileWriter(?), ref serializer: ?srt2)  where srt2 != IO.defaultSerializer
proc staticTensor.serialize(writer: IO.fileWriter(locking = false, IO.defaultSerializer), ref serializer: IO.defaultSerializer, param capitalT: bool)  where capitalT == true
proc ref staticTensor.read(fr: IO.fileReader(?)) throws