SonicBoom

Coming from PyTorch

SonicBoom is not PyTorch, but many of its names and conventions carry over. Type a PyTorch name below to see what the Guile binding offers for it:

The lookup matches full names and common spellings (nn.Linear, F.relu), and a name typed in the address bar, as in pytorch.html?q=torch.add, runs the same query.

Names with a SonicBoom counterpart

The table below lists only the names that are supported or have a recipe, grouped by the PyTorch module they come from. ### torch

Name Status SonicBoom
torch.Tensor supported <tensor>, tensor?, tensor-dtype, tensor-shape, tensor-requires-grad?, tensor-grad, set-tensor-grad!, ctensor?, ctensor-dtype, ctensor-shape
torch.abs recipe (ctensor->list (where (lt x 0.0) (neg x) x))
torch.add supported add
torch.amax supported amax
torch.bmm supported bmm
torch.broadcast_shapes supported broadcast-shapes
torch.clamp recipe (ctensor->list (where (lt x -0.5) -0.5 (where (gt x 0.5) 0.5 x)))
torch.concat supported concat
torch.div supported div
torch.eq supported equal-to
torch.exp supported texp
torch.flatten recipe (ctensor->list (reshape x (list (ctensor-numel x))))
torch.frombuffer supported bytevector->tensor, bytevector->ctensor, tensor-from-bytes
torch.gather supported gather
torch.gt supported gt
torch.index_select supported index-select
torch.load supported load-params!
torch.log supported tlog
torch.logical_and supported logical-and
torch.logical_not supported logical-not
torch.logical_or supported logical-or
torch.logical_xor recipe (ctensor->list (logical-not (equal-to a b)))
torch.lt supported lt
torch.matmul supported matmul
torch.maximum recipe (ctensor->list (where (gt a b) a b))
torch.mean supported mean
torch.minimum recipe (ctensor->list (where (lt a b) a b))
torch.mul supported mul
torch.narrow recipe (ctensor->list (slice x dim start (+ start length)))
torch.ne recipe (ctensor->list (logical-not (equal-to a b)))
torch.neg supported neg
torch.ones supported ones
torch.permute supported permute
torch.randn supported randn
torch.reciprocal recipe (ctensor->list (div 1.0 x))
torch.reshape supported reshape
torch.save supported save-params!
torch.sigmoid recipe (ctensor->list (div 1.0 (add 1.0 (texp (neg x)))))
torch.sqrt supported tsqrt
torch.square recipe (ctensor->list (mul x x))
torch.sub supported sub
torch.sum supported sum
torch.tanh supported ttanh
torch.tensor supported make-tensor, list->tensor, make-ctensor, list->ctensor, scalar->ctensor, tensor-from-list
torch.transpose supported transpose
torch.where supported where
torch.zeros supported zeros

torch.Tensor

Name Status SonicBoom
torch.Tensor.backward supported autograd-backward
torch.Tensor.clone supported tensor-copy, ctensor-copy
torch.Tensor.expand supported expand
torch.Tensor.grad supported parameter-grad, autograd-grad
torch.Tensor.index_add_ supported index-add
torch.Tensor.is_cuda supported param-on-device?
torch.Tensor.item supported ctensor-item
torch.Tensor.nbytes supported ctensor-nbytes
torch.Tensor.numel supported tensor-numel, ctensor-numel
torch.Tensor.scatter_add_ supported scatter-add
torch.Tensor.tolist supported tensor->list, ctensor->list, ctensor->nested, tensor->list

torch.autograd

Name Status SonicBoom
torch.autograd.backward supported backward!
torch.autograd.grad supported grad

torch.func

Name Status SonicBoom
torch.func.grad_and_value supported value-and-grad

torch.nn

Name Status SonicBoom
torch.nn.Linear supported linear
torch.nn.Module supported nn-model?, nn-model-structure, nn-model-params, nn-model-input-dims
torch.nn.Sequential supported model?, model-layers, model-parameters, sequential

torch.nn.Module

Name Status SonicBoom
torch.nn.Module.forward supported model-forward-native, model-forward
torch.nn.Module.get_parameter supported layer-parameter-ref, model-parameter-ref

torch.nn.functional

Name Status SonicBoom
torch.nn.functional.cross_entropy supported fused-cross-entropy, cross-entropy
torch.nn.functional.embedding supported embedding
torch.nn.functional.gelu supported gelu
torch.nn.functional.hardtanh recipe (ctensor->list (where (lt x -1.0) -1.0 (where (gt x 1.0) 1.0 x)))
torch.nn.functional.layer_norm supported layer-norm
torch.nn.functional.leaky_relu recipe (ctensor->list (where (lt x 0.0) (mul 0.01 x) x))
torch.nn.functional.linear supported linear, autograd-linear
torch.nn.functional.log_softmax supported log-softmax
torch.nn.functional.mse_loss supported autograd-mse
torch.nn.functional.relu supported relu, relu, autograd-relu
torch.nn.functional.relu6 recipe (ctensor->list (where (lt x 0.0) 0.0 (where (gt x 6.0) 6.0 x)))
torch.nn.functional.rms_norm supported fused-rms-norm, rms-norm
torch.nn.functional.silu recipe (ctensor->list (mul x (div 1.0 (add 1.0 (texp (neg x))))))
torch.nn.functional.softmax supported fused-softmax, softmax

torch.nn.parameter

Name Status SonicBoom
torch.nn.parameter.Parameter supported make-param, parameter, leaf?, leaf-value, set-leaf-value!, leaf-grad, set-leaf-grad!

torch.nn.utils

Name Status SonicBoom
torch.nn.utils.clip_grad_norm_ supported fused-clip-grad-norm, clip-grad-norm!, clip-grad-norm!

torch.optim

Name Status SonicBoom
torch.optim.Adam supported adam-init, adam-update
torch.optim.AdamW supported adamw-step!
torch.optim.SGD supported sgd-update

torch.optim.AdamW

Name Status SonicBoom
torch.optim.AdamW.step supported param-step!

torch.optim.Optimizer

Name Status SonicBoom
torch.optim.Optimizer.zero_grad supported param-zero-grad!, zero-grad!, tape-zero-grad!

torch.optim.SGD

Name Status SonicBoom
torch.optim.SGD.step supported autograd-sgd-step!