Eager Tensor Operations #
PyTorch-style tensor operations recorded on the session's tape. Each one runs the CPU or the CUDA
kernel of the operation, as the session's device selects, and preserves the typed TensorRef
surface.
Convolution operations #
def
Runtime.Autograd.Torch.Internal.EagerSession.conv
{α : Type}
[TorchLean.Storage α]
(s : EagerSession α)
[Context α]
{d inC outC : ℕ}
{kernel stride padding inSpatial : TorchLean.Tensor ℕ [d]}
(w : TensorRef α (Spec.Shape.ofList (outC :: inC :: kernel.to (List ℕ))))
(b : TensorRef α [outC])
(x : TensorRef α (Spec.Shape.ofList (inC :: inSpatial.to (List ℕ))))
:
IO (TensorRef α (Spec.Shape.ofList (outC :: (Spec.convOutSpatial inSpatial kernel stride padding).to (List ℕ))))
N-D convolution for channels-first tensors (inC, spatial...) (no batch axis).
PyTorch comparison: torch.nn.functional.conv{d}d specialized to a single sample.
Instances For
def
Runtime.Autograd.Torch.Internal.EagerSession.convTranspose
{α : Type}
[TorchLean.Storage α]
(s : EagerSession α)
[Context α]
{d inC outC : ℕ}
{kernel stride padding inSpatial : TorchLean.Tensor ℕ [d]}
(w : TensorRef α (Spec.Shape.ofList (inC :: outC :: kernel.to (List ℕ))))
(b : TensorRef α [outC])
(x : TensorRef α (Spec.Shape.ofList (inC :: inSpatial.to (List ℕ))))
:
IO
(TensorRef α (Spec.Shape.ofList (outC :: (Spec.convTransposeOutSpatial inSpatial kernel stride padding).to (List ℕ))))
N-D transpose convolution for channels-first tensors (inC, spatial...) (no batch axis).
PyTorch comparison: torch.nn.functional.conv_transpose{d}d specialized to a single sample.