评价此页

strict_fusion#

class torch.jit.strict_fusion[source]#

在推理中,如果没有融合所有节点,或在训练中没有符号化区分,则会报错。

示例:强制融合加法运算。

@torch.jit.script
def foo(x):
    with torch.jit.strict_fusion():
        return x + x + x