mirror of
https://github.com/zama-ai/concrete.git
synced 2026-01-21 02:37:58 -05:00
60 lines
2.7 KiB
Markdown
60 lines
2.7 KiB
Markdown
<!-- markdownlint-disable -->
|
|
|
|
<a href="../../../compilers/concrete-compiler/compiler/lib/Bindings/Python/concrete/fhe/extensions/convolution.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
|
|
|
|
# <kbd>module</kbd> `concrete.fhe.extensions.convolution`
|
|
Tracing and evaluation of convolution.
|
|
|
|
**Global Variables**
|
|
---------------
|
|
- **SUPPORTED_AUTO_PAD**
|
|
|
|
---
|
|
|
|
<a href="../../../compilers/concrete-compiler/compiler/lib/Bindings/Python/concrete/fhe/extensions/convolution.py#L25"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>
|
|
|
|
## <kbd>function</kbd> `conv`
|
|
|
|
```python
|
|
conv(
|
|
x: Union[ndarray, Tracer],
|
|
weight: Union[ndarray, List, Tracer],
|
|
bias: Optional[ndarray, List, Tracer] = None,
|
|
pads: Optional[Tuple[int, ], List[int]] = None,
|
|
strides: Optional[Tuple[int, ], List[int]] = None,
|
|
dilations: Optional[Tuple[int, ], List[int]] = None,
|
|
kernel_shape: Optional[Tuple[int, ], List[int]] = None,
|
|
group: int = 1,
|
|
auto_pad: str = 'NOTSET'
|
|
) → Union[ndarray, Tracer]
|
|
```
|
|
|
|
Trace and evaluate convolution operations.
|
|
|
|
Refer to https://github.com/onnx/onnx/blob/main/docs/Operators.md#Conv for more info.
|
|
|
|
|
|
|
|
**Args:**
|
|
|
|
- <b>`x`</b> (Union[np.ndarray, Tracer]): input of shape (N, C, D1, ..., DN)
|
|
- <b>`weight`</b> (Union[np.ndarray, Tracer]): kernel of shape (F, C / group, K1, ..., KN)
|
|
- <b>`bias`</b> (Optional[Union[np.ndarray, Tracer]], optional): bias of shape (F,). Defaults to None. pads (Optional[Union[Tuple[int, ...], List[int]]], optional): padding for the beginning and ending along each spatial axis (D1_begin, D2_begin, ..., D1_end, D2_end, ...). Will be set to 0 along each spatial axis if not set. strides (Optional[Union[Tuple[int, ...], List[int]]], optional): stride along each spatial axis. Will be set to 1 along each spatial axis if not set. dilations (Optional[Union[Tuple[int, ...], List[int]]], optional): dilation along each spatial axis. Will be set to 1 along each spatial axis if not set. kernel_shape (Optional[Union[Tuple[int, ...], List[int]]], optional): shape of the convolution kernel. Inferred from input weight if not present group (int, optional): number of groups input channels and output channels are divided into. Defaults to 1.
|
|
- <b>`auto_pad`</b> (str, optional): padding strategy. Defaults to "NOTSET".
|
|
|
|
|
|
|
|
**Raises:**
|
|
|
|
- <b>`ValueError`</b>: if arguments are not appropriate
|
|
- <b>`TypeError`</b>: unexpected types
|
|
- <b>`NotImplementedError`</b>: a convolution that we don't support
|
|
|
|
|
|
|
|
**Returns:**
|
|
|
|
- <b>`Union[np.ndarray, Tracer]`</b>: evaluation result or traced computation
|
|
|
|
|