concrete.ml.quantization.quantized_ops.md
Last updated
Last updated
concrete.ml.quantization.quantized_ops
Quantized versions of the ONNX operators for post training quantization.
QuantizedSigmoid
Quantized sigmoid op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedHardSigmoid
Quantized HardSigmoid op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedRelu
Quantized Relu op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedPRelu
Quantized PRelu op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedLeakyRelu
Quantized LeakyRelu op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedHardSwish
Quantized Hardswish op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedElu
Quantized Elu op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedSelu
Quantized Selu op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedCelu
Quantized Celu op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedClip
Quantized clip op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedRound
Quantized round op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
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:
List[str]
: the names of the tensors
QuantizedGemm
Quantized Gemm op.
__init__
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
q_impl
QuantizedMatMul
Quantized MatMul op.
__init__
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
q_impl
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:
List[str]
: the names of the tensors
can_fuse
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
q_impl
QuantizedTanh
Quantized Tanh op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedSoftplus
Quantized Softplus op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedExp
Quantized Exp op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedLog
Quantized Log op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedAbs
Quantized Abs op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
QuantizedIdentity
Quantized Identity op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
q_impl
QuantizedReshape
Quantized Reshape op.
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
q_impl
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
QuantizedConv
Quantized Conv op.
__init__
Construct the quantized convolution operator and retrieve parameters.
Args:
n_bits_output
: number of bits for the quantization of the outputs of this operator
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:
List[str]
: the names of the tensors
q_impl
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,)
attrs
: convolution options handled in constructor
Returns:
res
(QuantizedArray): result of the quantized integer convolution
QuantizedAvgPool
Quantized Average Pooling op.
__init__
property int_input_names
Get the names of encrypted integer tensors that are used by this op.
Returns:
List[str]
: the names of the tensors
q_impl
QuantizedMaxPool
Quantized Max Pooling op.
__init__