Files
torus-ml/docs/references/api/torus.ml.torch.hybrid_backprop_linear.md
zeekay e037e8f7ea torus: one name for the package, and it is ours
The distribution called itself torus-ml while shipping a package directory
named concrete, so the name a user installs and the name they import disagreed
— and most of the tree already said torus.ml, which could not resolve against
src/concrete. Moved src/concrete to src/torus and pointed the include at it.

The dependency was Zama's concrete-python from their index. It is torus-fhe
from ours, which is what luxfhe/torus already ships: that frontend declares
torus-fhe and ships a torus/fhe module, so every 'from torus.fhe' in this tree
was already naming our compiler and only the dependency lagged.

Two distributions share one namespace, which is the shape the upstream this
forked from used and the reason the split works: torus-fhe gives torus.fhe,
torus-ml gives torus.ml.

Swept every other spelling — identifiers, enum members, workflow variables,
filenames, notebooks. LICENSE and NOTICE keep the upstream attribution a fork
owes; the figures carry the old name in JPEG metadata a text sweep cannot
reach.
2026-08-27 13:20:50 -07:00

5.1 KiB

module torus.ml.torch.hybrid_backprop_linear

Linear layer implementations for backprop FHE-compatible models.


class ForwardModuleLinear

Forward module for linear layers.

method __init__

__init__(weight, bias=None, weight_transposed=False)

method forward

forward(input_tensor)

Forward pass for linear layers.

Args:

  • input_tensor: The input tensor.

Returns: The output tensor after applying the linear transformation.


class BackwardModuleLinear

Backward module for linear layers.

method __init__

__init__(weight, weight_transposed=False)

method forward

forward(grad_output)

Backward pass for linear layers.

Args:

  • grad_output: The gradient output tensor.

Returns: The gradient input tensor after applying the backward pass.


class CustomLinear

Custom linear module.

method __init__

__init__(weight, bias=None, weight_transposed=False)

method forward

forward(input_tensor)

Forward pass of the custom linear module.

Args:

  • input_tensor: The input tensor.

Returns: The output tensor after applying the custom linear module.


class ForwardBackwardModule

Custom autograd function for forward and backward passes.


method backward

backward(ctx, grad_output)

Backward pass of the custom autograd function.

Args:

  • ctx: The context object.
  • grad_output: The gradient output tensor.

Returns: The gradient input tensor after applying the backward pass.


method forward

forward(ctx, input_tensor, forward_module, backward_module)

Forward pass of the custom autograd function.

Args:

  • ctx: The context object.
  • input_tensor: The input tensor.
  • forward_module: The forward module.
  • backward_module: The backward module.

Returns: The output tensor after applying the forward pass.