FuseCustomConfig
- 类 torch.ao.quantization.fx.custom_config.FuseCustomConfig[源代码]
-
用于
fuse_fx()
的自定义配置。示例用法:
fuse_custom_config = FuseCustomConfig().set_preserved_attributes(["attr1", "attr2"])
- classmethodfrom_dict(fuse_custom_config_dict)[源代码]
-
使用包含以下项目的字典来创建一个
ConvertCustomConfig
:"preserved_attributes": 一个属性列表,这些属性即使在
forward
中未被使用也会被保留。此函数主要用于保持 backward 兼容性,未来可能会被移除。
注意这里的backward建议翻译为“向后”,以增加理解的自然度。但按照要求只返回答案本身的话:此函数主要用于向后兼容,将来可能会被移除。
- 返回类型
- set_preserved_attributes(attributes)[源代码]
-
设置将在图模块中保留的属性名称,即使这些属性未在模型的
forward
方法中使用。- 返回类型
- to_dict()[源代码]
-
将此
FuseCustomConfig
转换为一个字典,其中包含from_dict()
中描述的项。