megengine.module.qat.ConvBnRelu2d

class ConvBnRelu2d(in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, bias=True, conv_mode='cross_correlation', compute_mode='default', eps=1e-05, momentum=0.9, affine=True, track_running_stats=True, **kwargs)[源代码]

支持 QAT 并融合 Conv2d, BatchNorm2dreluQATModule. 可搭配使用 ObserverFakeQuantize.

属性。

with_act

with_weight

方法

apply(fn)

对当前模块中的所有模块应用函数 fn,包括当前模块本身。

apply_quant_activation(target)

target 上根据 qconfig 应用权重observer以及fake_quant。

apply_quant_bias(target, inp, w_qat)

使用 fake_quant_bias 来处理 target.

apply_quant_weight(target)

target 上根据 qconfig 应用权重observer以及fake_quant。

buffers([recursive])

返回该模块中对于buffers的一个可迭代对象。

calc_conv_bn_qat(inp[, approx])

children(**kwargs)

返回一个可迭代对象,可遍历所有属于当前模块的直接属性的子模块。

disable_quantize([value])

设置 modulequantize_diabled 属性,并返回 module

eval()

当前模块中所有模块的 training 属性(包括自身)置为 False ,并将其切换为推理模式。

fold_weight_bias(bn_mean, bn_var)

forward(inp)

from_float_module(float_module)

get_activation_dtype()

按照qconfig指定的方法,从 qconfig 中获取激活值的量化数据类型。

get_activation_qparams()

获取激活值的量化参数。

get_batch_mean_var(inp)

get_weight_dtype()

qconfig 中获取权重的量化数据类型。

get_weight_qparams()

获取权重的量化参数。

load_state_dict(state_dict[, strict])

加载一个参数字典,这个字典通常使用 state_dict 得到。

modules(**kwargs)

返回一个可迭代对象,可以遍历当前模块中的所有模块,包括其本身。

named_buffers([prefix, recursive])

返回可遍历模块中 key 与 buffer 的键值对的可迭代对象,其中 key 为从该模块至 buffer 的点路径(dotted path)。

named_children(**kwargs)

返回可迭代对象,可以遍历属于当前模块的直接属性的所有子模块(submodule)与键(key)组成的”key-submodule”对,其中'key'是子模块对应的属性名。

named_modules([prefix])

返回可迭代对象,可以遍历当前模块包括自身在内的所有其内部模块所组成的key-module键-模块对,其中'key'是从当前模块到各子模块的点路径(dotted path)。

named_parameters([prefix, recursive])

返回一个可迭代对象,可以遍历当前模块中key与 Parameter 组成的键值对。其中 key 是从模块到 Parameter 的点路径(dotted path)。

named_tensors([prefix, recursive])

Returns an iterable for key tensor pairs of the module, where key is the dotted path from this module to the tensor.

parameters([recursive])

返回一个可迭代对象,遍历当前模块中的所有 Parameter

register_forward_hook(hook)

给模块输出注册一个回调函数。

register_forward_pre_hook(hook)

给模块输入注册一个回调函数。

replace_param(params, start_pos[, seen])

Replaces module's parameters with params, used by ParamPack to

set_fake_quant(enable)

set_observer(enable)

set_qconfig(qconfig)

使用 qconfig 更改量化相关配置。包含权重和激活值的 observer 和 fake_quant 。

state_dict([rst, prefix, keep_var])

tensors([recursive])

Returns an iterable for the Tensor of the module.

train([mode, recursive])

当前模块中所有模块的 training 属性(包括自身)置为 mode

update_running_mean_and_running_var(bn_mean, ...)

zero_grad()

将所有参数的梯度置0。