Created by: chenwhql
PR types
Bug fixes
PR changes
APIs
Describe
Fix loaded no params layer execution error
Layer may not contain any parameters, in this case, jit.load will throw error when loading params from default path.
examples like:
class EmptyLayer(paddle.nn.Layer):
def __init__(self):
super(EmptyLayer, self).__init__()
@paddle.jit.to_static
def forward(self, x):
return x
class NoParamLayer(paddle.nn.Layer):
def __init__(self):
super(NoParamLayer, self).__init__()
@paddle.jit.to_static
def forward(self, x, y):
return x + y
注意:run_program_op仅在动态图下使用,是个特殊op,用于在动态图下执行静态图的program,不会保存到inference model中,后续也不会保存到inference_model中,对预测兼容性没有影响