Files
torus/docs/dev/api/torus.fhe.extensions.maxpool.md
zeekay f968edf75a Rename the Concrete dialect and project identifiers to Torus
The MLIR dialect, its conversion passes (TFHEToConcrete, ConcreteToCAPI,
ConcreteToLLVM), the optimizer component, the compiler binary, the Rust
crate and the program_info parameter file all still carried the upstream
project's name. They now carry this one's.

Two things deliberately keep the word, because in them it is not the name.
mlir::OpTrait CRTP parameters mean "the derived type", so they are spelled
Derived and OpTy — LLVM's other conventional spelling for the same idiom.
concreteShape is a capnp field: renaming it would change the serialized
protocol, and the prose describing it is ordinary English.

This also repairs references the earlier partial rename left dangling:
Security.cpp included concrete/curves.gen.h and the directory is torus/,
torus-cpu.h included concrete-num_complex.h, the Torus dialect CMakeLists
named ConcreteOps.td, and compiler/setup.py asked find_namespace_packages
for a "concrete" package that no longer exists — so it built without the
package it ships.
2026-08-27 13:17:38 -07:00

2.3 KiB

module torus.fhe.extensions.maxpool

Tracing and evaluation of maxpool.

Global Variables

  • AVAILABLE_AUTO_PAD
  • AVAILABLE_CEIL_MODE
  • AVAILABLE_STORAGE_ORDER
  • SUPPORTED_AUTO_PAD
  • SUPPORTED_CEIL_MODE
  • SUPPORTED_STORAGE_ORDER

function maxpool

maxpool(
    x: Union[ndarray, Tracer],
    kernel_shape: Union[tuple[int, ], list[int]],
    strides: Optional[tuple[int, ], list[int]] = None,
    auto_pad: str = 'NOTSET',
    pads: Optional[tuple[int, ], list[int]] = None,
    dilations: Optional[tuple[int, ], list[int]] = None,
    ceil_mode: int = 0,
    storage_order: int = 0
) → Union[ndarray, Tracer]

Evaluate or trace MaxPool operation.

Refer to https://github.com/onnx/onnx/blob/main/docs/Operators.md#maxpool for more info.

Args: x (Union[np.ndarray, Tracer]): input of shape (N, C, D1, ..., DN)

kernel_shape (Union[Tuple[int, ...], List[int]]): shape of the kernel

strides (Optional[Union[Tuple[int, ...], List[int]]]): stride along each spatial axis set to 1 along each spatial axis if not set

auto_pad (str, default = "NOTSET"): padding strategy

pads (Optional[Union[Tuple[int, ...], List[int]]]): padding for the beginning and ending along each spatial axis (D1_begin, D2_begin, ..., D1_end, D2_end, ...) set to 0 along each spatial axis if not set

dilations (Optional[Union[Tuple[int, ...], List[int]]]): dilation along each spatial axis set to 1 along each spatial axis if not set

ceil_mode (int, default = 1): ceiling mode

storage_order (int, default = 0): storage order, 0 for row major, 1 for column major

Raises: TypeError: if arguments are inappropriately typed

ValueError: if arguments are inappropriate

NotImplementedError: if desired operation is not supported yet

Returns: Union[np.ndarray, Tracer]: maxpool over the input or traced computation