megengine.module.quantized package

megengine.module.quantized.batch_matmul_activation

class megengine.module.quantized.batch_matmul_activation.BatchMatMulActivation(batch, in_features, out_features, bias=True, nonlinear_mode='IDENTITY', dtype=None, **kwargs)[source]

Bases: megengine.module.batch_matmul_activation.BatchMatMulActivation, megengine.module.quantized.module.QuantizedModule

calc_bmm_quantized(inp)[source]
forward(inp)[source]
classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.

megengine.module.quantized.concat

class megengine.module.quantized.concat.Concat(dtype=None)[source]

Bases: megengine.module.quantized.module.QuantizedModule

A QuantizedModule to do quantized concat, used for inference only.

forward(inps, axis=0)[source]
classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.

megengine.module.quantized.conv

class megengine.module.quantized.conv.Conv2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, conv_mode='CROSS_CORRELATION', compute_mode='DEFAULT', dtype=None)[source]

Bases: megengine.module.conv.Conv2d, megengine.module.quantized.module.QuantizedModule

Quantized version of Conv2d.

calc_conv_quantized(inp, nonlinear_mode='IDENTITY')[source]
forward(inp)[source]
classmethod from_qat_module(qat_module)[source]

return a QuantizedModule instance converted from a QATModule instance.

class megengine.module.quantized.conv.ConvRelu2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, conv_mode='CROSS_CORRELATION', compute_mode='DEFAULT', dtype=None)[source]

Bases: megengine.module.quantized.conv.Conv2d

Quantized version of ConvRelu2d.

forward(inp)[source]

megengine.module.quantized.conv_bn

class megengine.module.quantized.conv_bn.ConvBn2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, conv_mode='CROSS_CORRELATION', compute_mode='DEFAULT', dtype=None)[source]

Bases: megengine.module.quantized.conv_bn._ConvBnActivation2d

Quantized version of ConvBn2d.

forward(inp)[source]
class megengine.module.quantized.conv_bn.ConvBnRelu2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, conv_mode='CROSS_CORRELATION', compute_mode='DEFAULT', dtype=None)[source]

Bases: megengine.module.quantized.conv_bn._ConvBnActivation2d

Quantized version of ConvBnRelu2d.

forward(inp)[source]

megengine.module.quantized.elemwise

class megengine.module.quantized.elemwise.Elemwise(method, dtype=None)[source]

Bases: megengine.module.quantized.module.QuantizedModule

Quantized version of Elemwise.

forward(*inps)[source]
classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.

megengine.module.quantized.linear

class megengine.module.quantized.linear.Linear(dtype=None)[source]

Bases: megengine.module.quantized.module.QuantizedModule

Quantized version of Linear.

forward(inp)[source]
classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.

megengine.module.quantized.module

class megengine.module.quantized.module.QuantizedModule[source]

Bases: megengine.module.module.Module

Base class of quantized Module, which should be converted from QATModule and not support traning.

abstract classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.

megengine.module.quantized.quant_dequant

class megengine.module.quantized.quant_dequant.DequantStub[source]

Bases: megengine.module.quantized.module.QuantizedModule

Quantized version of DequantStub, will restore quantized input to float32 dtype.

forward(inp)[source]
classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.

class megengine.module.quantized.quant_dequant.QuantStub(dtype=None)[source]

Bases: megengine.module.quantized.module.QuantizedModule

Quantized version of QuantStub, will convert input to quantized dtype.

forward(inp)[source]
classmethod from_qat_module(qat_module)[source]

Return a QuantizedModule instance converted from a QATModule instance.