# concrete.ml.quantization.quantized\_ops.md

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L0)

## module `concrete.ml.quantization.quantized_ops`

Quantized versions of the ONNX operators for post training quantization.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L52)

### class `QuantizedSigmoid`

Quantized sigmoid op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L58)

### class `QuantizedHardSigmoid`

Quantized HardSigmoid op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L64)

### class `QuantizedRelu`

Quantized Relu op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L70)

### class `QuantizedPRelu`

Quantized PRelu op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L76)

### class `QuantizedLeakyRelu`

Quantized LeakyRelu op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L82)

### class `QuantizedHardSwish`

Quantized Hardswish op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L88)

### class `QuantizedElu`

Quantized Elu op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L94)

### class `QuantizedSelu`

Quantized Selu op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L100)

### class `QuantizedCelu`

Quantized Celu op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L106)

### class `QuantizedClip`

Quantized clip op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L112)

### class `QuantizedRound`

Quantized round op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L118)

### class `QuantizedPow`

Quantized pow op.

Only works for a float constant power. This operation will be fused to a (potentially larger) TLU.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L128)

### class `QuantizedGemm`

Quantized Gemm op.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L133)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L166)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    calibrate_rounding: bool = False,
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L300)

### class `QuantizedMatMul`

Quantized MatMul op.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L133)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L166)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    calibrate_rounding: bool = False,
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L306)

### class `QuantizedAdd`

Quantized Addition operator.

Can add either two variables (both encrypted) or a variable and a constant

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L412)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Add operation can be computed in float and fused if it operates over inputs produced by a single integer tensor. For example the expression x + x \* 1.75, where x is an encrypted tensor, can be computed with a single TLU.

**Returns:**

* `bool`: Whether the number of integer input tensors allows computing this op as a TLU

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L315)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L426)

### class `QuantizedTanh`

Quantized Tanh op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L432)

### class `QuantizedSoftplus`

Quantized Softplus op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L438)

### class `QuantizedExp`

Quantized Exp op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L444)

### class `QuantizedLog`

Quantized Log op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L450)

### class `QuantizedAbs`

Quantized Abs op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L456)

### class `QuantizedIdentity`

Quantized Identity op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L461)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L475)

### class `QuantizedReshape`

Quantized Reshape op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L516)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Max Pooling operation can not be fused since it must be performed over integer tensors and it combines different elements of the input tensors.

**Returns:**

* `bool`: False, this operation can not be fused as it adds different encrypted integers

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L481)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Reshape the input integer encrypted tensor.

**Args:**

* `q_inputs`: an encrypted integer tensor at index 0 and one constant shape at index 1
* `attrs`: additional optional reshape options

**Returns:**

* `result` (QuantizedArray): reshaped encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L528)

### class `QuantizedConv`

Quantized Conv op.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L533)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

Construct the quantized convolution operator and retrieve parameters.

**Args:**

* `n_bits_output`: number of bits for the quantization of the outputs of this operator
* `op_instance_name` (str): The name that should be assigned to this operation, used to retrieve it later or get debugging information about this op (bit-width, value range, integer intermediary values, op-specific error messages). Usually this name is the same as the ONNX operation name for which this operation is constructed.
* `int_input_names`: names of integer tensors that are taken as input for this operation
* `constant_inputs`: the weights and activations
* `input_quant_opts`: options for the input quantizer
* `attrs`: convolution options
* `dilations` (Tuple\[int]): dilation of the kernel. Default to 1 on all dimensions.
* `group` (int): number of convolution groups. Default to 1.
* `kernel_shape` (Tuple\[int]): shape of the kernel. Should have 2 elements for 2d conv
* `pads` (Tuple\[int]): padding in ONNX format (begin, end) on each axis
* `strides` (Tuple\[int]): stride of the convolution on each axis

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L598)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    calibrate_rounding: bool = False,
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Compute the quantized convolution between two quantized tensors.

Allows an optional quantized bias.

**Args:**

* `q_inputs`: input tuple, contains
* `x` (numpy.ndarray): input data. Shape is N x C x H x W for 2d
* `w` (numpy.ndarray): weights tensor. Shape is (O x I x Kh x Kw) for 2d
* `b` (numpy.ndarray, Optional): bias tensor, Shape is (O,)
* `calibrate_rounding` (bool): Whether to calibrate rounding
* `attrs`: convolution options handled in constructor

**Returns:**

* `res` (QuantizedArray): result of the quantized integer convolution

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L779)

### class `QuantizedAvgPool`

Quantized Average Pooling op.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L785)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L831)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    calibrate_rounding: bool = False,
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L922)

### class `QuantizedMaxPool`

Quantized Max Pooling op.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L928)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1039)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Max Pooling operation can not be fused since it must be performed over integer tensors and it combines different elements of the input tensors.

**Returns:**

* `bool`: False, this operation can not be fused as it adds different encrypted integers

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L976)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1051)

### class `QuantizedPad`

Quantized Padding op.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1056)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1123)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Pad operation cannot be fused since it must be performed over integer tensors.

**Returns:**

* `bool`: False, this operation cannot be fused as it is manipulates integer tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1082)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    calibrate_rounding: bool = False,
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1134)

### class `QuantizedWhere`

Where operator on quantized arrays.

Supports only constants for the results produced on the True/False branches.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1143)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1174)

### class `QuantizedCast`

Cast the input to the required data type.

In FHE we only support a limited number of output types. Booleans are cast to integers.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1183)

### class `QuantizedGreater`

Comparison operator >.

Only supports comparison with a constant.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1192)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1215)

### class `QuantizedGreaterOrEqual`

Comparison operator >=.

Only supports comparison with a constant.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1224)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1247)

### class `QuantizedLess`

Comparison operator <.

Only supports comparison with a constant.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1256)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1279)

### class `QuantizedLessOrEqual`

Comparison operator <=.

Only supports comparison with a constant.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1288)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: QuantizationOptions = None,
    **attrs
) → None
```

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1311)

### class `QuantizedOr`

Or operator ||.

This operation is not really working as a quantized operation. It just works when things got fused, as in e.g., Act(x) = x || (x + 42))

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1321)

### class `QuantizedDiv`

Div operator /.

This operation is not really working as a quantized operation. It just works when things got fused, as in e.g., Act(x) = 1000 / (x + 42))

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1331)

### class `QuantizedMul`

Multiplication operator.

Only multiplies an encrypted tensor with a float constant for now. This operation will be fused to a (potentially larger) TLU.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1341)

### class `QuantizedSub`

Subtraction operator.

This works the same as addition on both encrypted - encrypted and on encrypted - constant.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L412)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Add operation can be computed in float and fused if it operates over inputs produced by a single integer tensor. For example the expression x + x \* 1.75, where x is an encrypted tensor, can be computed with a single TLU.

**Returns:**

* `bool`: Whether the number of integer input tensors allows computing this op as a TLU

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L315)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1351)

### class `QuantizedBatchNormalization`

Quantized Batch normalization with encrypted input and in-the-clear normalization params.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1357)

### class `QuantizedFlatten`

Quantized flatten for encrypted inputs.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1404)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Flatten operation cannot be fused since it must be performed over integer tensors.

**Returns:**

* `bool`: False, this operation cannot be fused as it is manipulates integer tensors.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1363)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Flatten the input integer encrypted tensor.

**Args:**

* `q_inputs`: an encrypted integer tensor at index 0
* `attrs`: contains axis attribute

**Returns:**

* `result` (QuantizedArray): reshaped encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1416)

### class `QuantizedReduceSum`

ReduceSum with encrypted input.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1421)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: Optional[QuantizationOptions] = None,
    **attrs
) → None
```

Construct the quantized ReduceSum operator and retrieve parameters.

**Args:**

* `n_bits_output` (int): Number of bits for the operator's quantization of outputs.
* `op_instance_name` (str): The name that should be assigned to this operation, used to retrieve it later or get debugging information about this op (bit-width, value range, integer intermediary values, op-specific error messages). Usually this name is the same as the ONNX operation name for which this operation is constructed.
* `int_input_names` (Optional\[Set\[str]]): Names of input integer tensors. Default to None.
* `constant_inputs` (Optional\[Dict]): Input constant tensor.
* `axes` (Optional\[numpy.ndarray]): Array of integers along which to reduce. The default is to reduce over all the dimensions of the input tensor if 'noop\_with\_empty\_axes' is false, else act as an Identity op when 'noop\_with\_empty\_axes' is true. Accepted range is \[-r, r-1] where r = rank(data). Default to None.
* `input_quant_opts` (Optional\[QuantizationOptions]): Options for the input quantizer. Default to None.
* `attrs` (dict): RecuseSum options.
* `keepdims` (int): Keep the reduced dimension or not, 1 means keeping the input dimension, 0 will reduce it along the given axis. Default to 1.
* `noop_with_empty_axes` (int): Defines behavior if 'axes' is empty or set to None. Default behavior with 0 is to reduce all axes. When axes is empty and this attribute is set to true 1, input tensor will not be reduced, and the output tensor would be equivalent to input tensor. Default to 0.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1471)

#### method `calibrate`

```python
calibrate(*inputs: ndarray) → ndarray
```

Create corresponding QuantizedArray for the output of the activation function.

**Args:**

* `*inputs (numpy.ndarray)`: Calibration sample inputs.

**Returns:**

* `numpy.ndarray`: The output values for the provided calibration samples.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1495)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Sum the encrypted tensor's values along the given axes.

**Args:**

* `q_inputs` (QuantizedArray): An encrypted integer tensor at index 0.
* `attrs` (Dict): Options are handled in constructor.

**Returns:**

* `(QuantizedArray)`: The sum of all values along the given axes.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1618)

### class `QuantizedErf`

Quantized erf op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1624)

### class `QuantizedNot`

Quantized Not op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1630)

### class `QuantizedBrevitasQuant`

Brevitas uniform quantization with encrypted input.

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1640)

#### method `__init__`

```python
__init__(
    n_bits_output: int,
    op_instance_name: str,
    int_input_names: Set[str] = None,
    constant_inputs: Optional[Dict[str, Any], Dict[int, Any]] = None,
    input_quant_opts: Optional[QuantizationOptions] = None,
    **attrs
) → None
```

Construct the Brevitas quantization operator.

**Args:**

* `n_bits_output` (int): Number of bits for the operator's quantization of outputs. Not used, will be overridden by the bit\_width in ONNX
* `op_instance_name` (str): The name that should be assigned to this operation, used to retrieve it later or get debugging information about this op (bit-width, value range, integer intermediary values, op-specific error messages). Usually this name is the same as the ONNX operation name for which this operation is constructed.
* `int_input_names` (Optional\[Set\[str]]): Names of input integer tensors. Default to None.
* `constant_inputs` (Optional\[Dict]): Input constant tensor.
* `scale` (float): Quantizer scale
* `zero_point` (float): Quantizer zero-point
* `bit_width` (int): Number of bits of the integer representation
* `input_quant_opts` (Optional\[QuantizationOptions]): Options for the input quantizer. Default to None. attrs (dict):
* `rounding_mode` (str): Rounding mode (default and only accepted option is "ROUND")
* `signed` (int): Whether this op quantizes to signed integers (default 1),
* `narrow` (int): Whether this op quantizes to a narrow range of integers e.g., \[-2**n\_bits-1 .. 2**n\_bits-1] (default 0),

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1742)

#### method `calibrate`

```python
calibrate(*inputs: ndarray) → ndarray
```

Create corresponding QuantizedArray for the output of Quantization function.

**Args:**

* `*inputs (numpy.ndarray)`: Calibration sample inputs.

**Returns:**

* `numpy.ndarray`: the output values for the provided calibration samples.

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1768)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Quantize values.

**Args:**

* `q_inputs`: an encrypted integer tensor at index 0, scale, zero\_point, n\_bits at indices 1,2,3
* `attrs`: additional optional attributes

**Returns:**

* `result` (QuantizedArray): reshaped encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1833)

### class `QuantizedTranspose`

Transpose operator for quantized inputs.

This operator performs quantization and transposes the encrypted data. When the inputs are pre-computed QAT the input is only quantized if needed.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1875)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Transpose can not be fused since it must be performed over integer tensors as it moves around different elements of these input tensors.

**Returns:**

* `bool`: False, this operation can not be fused as it copies encrypted integers

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1843)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Transpose the input integer encrypted tensor.

**Args:**

* `q_inputs`: an encrypted integer tensor at index 0 and one constant shape at index 1
* `attrs`: additional optional reshape options

**Returns:**

* `result` (QuantizedArray): transposed encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1887)

### class `QuantizedFloor`

Quantized Floor op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1893)

### class `QuantizedMax`

Quantized Max op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1899)

### class `QuantizedMin`

Quantized Min op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1905)

### class `QuantizedNeg`

Quantized Neg op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1911)

### class `QuantizedSign`

Quantized Neg op.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1917)

### class `QuantizedUnsqueeze`

Unsqueeze operator.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1957)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Unsqueeze can not be fused since it must be performed over integer tensors as it reshapes an encrypted tensor.

**Returns:**

* `bool`: False, this operation can not be fused as it operates on encrypted tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1923)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Unsqueeze the input tensors on a given axis.

**Args:**

* `q_inputs`: an encrypted integer tensor at index 0, axes at index 1
* `attrs`: additional optional unsqueeze options

**Returns:**

* `result` (QuantizedArray): unsqueezed encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1969)

### class `QuantizedConcat`

Concatenate operator.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2025)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Concatenation can not be fused since it must be performed over integer tensors as it copies encrypted integers from one tensor to another.

**Returns:**

* `bool`: False, this operation can not be fused as it copies encrypted integers

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L1975)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Concatenate the input tensors on a given axis.

**Args:**

* `q_inputs`: an encrypted integer tensor
* `attrs`: additional optional concatenate options

**Returns:**

* `result` (QuantizedArray): concatenated encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2037)

### class `QuantizedSqueeze`

Squeeze operator.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2077)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

Squeeze can not be fused since it must be performed over integer tensors as it reshapes encrypted tensors.

**Returns:**

* `bool`: False, this operation can not be fused as it reshapes encrypted tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2043)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

Squeeze the input tensors on a given axis.

**Args:**

* `q_inputs`: an encrypted integer tensor at index 0, axes at index 1
* `attrs`: additional optional squeeze options

**Returns:**

* `result` (QuantizedArray): squeezed encrypted integer tensor

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2089)

### class `ONNXShape`

Shape operator.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2104)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

This operation returns the shape of the tensor and thus can not be fused into a univariate TLU.

**Returns:**

* `bool`: False, this operation can not be fused

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2094)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2116)

### class `ONNXConstantOfShape`

ConstantOfShape operator.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2121)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

This operation returns a new encrypted tensor and thus can not be fused.

**Returns:**

* `bool`: False, this operation can not be fused

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2133)

### class `ONNXGather`

Gather operator.

Returns values at requested indices from the input tensor.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2165)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

This operation returns values from a tensor and thus can not be fused into a univariate TLU.

**Returns:**

* `bool`: False, this operation can not be fused

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2141)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2177)

### class `ONNXSlice`

Slice operator.

***

**property int\_input\_names**

Get the names of encrypted integer tensors that are used by this op.

**Returns:**

* `Set[str]`: the names of the tensors

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2206)

#### method `can_fuse`

```python
can_fuse() → bool
```

Determine if this op can be fused.

This operation returns values from a tensor and thus can not be fused into a univariate TLU.

**Returns:**

* `bool`: False, this operation can not be fused

***

[![](https://img.shields.io/badge/-source-cccccc?style=flat-square)](https://github.com/zama-ai/concrete-ml/blob/release/1.1.x/src/concrete/ml/quantization/quantized_ops.py#L2182)

#### method `q_impl`

```python
q_impl(
    *q_inputs: Optional[ndarray, QuantizedArray],
    **attrs
) → Union[ndarray, QuantizedArray, NoneType]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zama.org/concrete-ml/1.1/developer-guide/api/concrete.ml.quantization.quantized_ops.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
