Talario\Tape
Requires a Talario build. Licensed builds are available through sales. There is no public download. Availability
__construct
new Tape(Device|string $device, int $nodeCapacity = ?, int $tensorCapacity = ?)
Create a tape bound to a device (object or 'cpu'/'gpu'/'auto'); shares the device's driver.
device
device(): string
Name of the backend this tape runs on.
tensor
tensor(array $data, ?array $shape = null, bool $requiresGrad = ?): int
Upload a float array as a device tensor; returns its tape id.
tensorBytes
tensorBytes(string $data, ?array $shape = null, bool $requiresGrad = ?): int
Take a packed f32 binary string as a tensor; returns its tape id.
param
param(Parameter $parameter): int
Bind a Parameter into this tape as a tensor id.
matmul
matmul(int $a, int $b): int
Matrix multiply C = A @ B.
add
add(int $a, int $b): int
Elementwise/broadcast add of two tensors.
addBias
addBias(int $pred, int $target): int
Broadcast-add a [n] bias vector over an [m,n] tensor.
linearReLU
linearReLU(int $x, int $w, int $b): int
Dense layer relu(x@W + b).
relu
relu(int $a): int
Elementwise ReLU.
sigmoid
sigmoid(int $a): int
Elementwise sigmoid.
tanh
tanh(int $a): int
Elementwise tanh.
gelu
gelu(int $a): int
Elementwise GELU, exact erf form 0.5*x*(1+erf(x/sqrt(2))); the PyTorch nn.GELU() / ONNX Gelu default.
geluTanh
geluTanh(int $a): int
Elementwise GELU, tanh approximation.
conv2d
conv2d(int $x, int $w, int $bias, int $kh, int $kw, int $stride, int $pad): int
2-D convolution (bias id, or -1 for no bias).
maxPool2d
maxPool2d(int $x, int $kh, int $kw, int $stride, int $pad): int
Spatial max pooling over an NHWC feature map.
reshape
reshape(int $id, array $shape): int
Reshape a tensor to a new shape (same element count).
flatten
flatten(int $a): int
Collapse a feature map [N, ...] to [N, flat].
mseLoss
mseLoss(int $pred, int $target): int
Mean squared error loss terminal.
softmaxCrossEntropy
softmaxCrossEntropy(int $pred, int $target): int
Softmax + cross-entropy loss terminal over logits vs one-hot targets.
backward
backward(int $loss): void
Reverse-mode pass from a loss terminal; accumulates gradients on all requires-grad tensors/params.
setInput
setInput(int $id, array $data): void
Overwrite an existing input tensor's data in place (host->device, no realloc).
compile
compile(callable $build, bool $withBackward = ?): Talario\CompiledGraph
Trace a build closure once into a replayable CompiledGraph (optionally forward-only).
compileStep
compileStep(callable $build, array $params, float $lr): Talario\CompiledGraph
Compile a full forward+backward+optimizer training step into one replayable graph.
grad
grad(int $id): array
Read back the gradient array for a tensor id.
value
value(int $id): array
Read back the value array for a tensor id.
gpuSubmitCount
staticgpuSubmitCount(): int
Process-wide count of backend queue submissions (instrumentation).
gpuDispatchCount
staticgpuDispatchCount(): int
Process-wide count of kernel dispatches (instrumentation).
Using a coding agent?
Copy a prompt for Talario\Tape, with 16 exact API signatures.