未验证 提交 a8dee3bb 编写于 作者: W Wilber 提交者: GitHub

fix convert ut framework problem (#35112)

上级 a5060b55
......@@ -137,8 +137,11 @@ def create_fake_model(program_config):
op_desc._set_attr(name, values)
for name, values in op_config.outputs.items():
op_desc.set_output(name, values)
var_desc = main_block_desc.var(cpt.to_bytes(name))
var_desc.set_type(core.VarDesc.VarType.LOD_TENSOR)
for v in values:
var_desc = main_block_desc.var(cpt.to_bytes(v))
var_desc.set_type(core.VarDesc.VarType.LOD_TENSOR)
var_desc.set_dtype(
convert_np_dtype_to_dtype_(tensor_config.dtype))
op_desc.infer_var_type(main_block_desc)
op_desc.infer_shape(main_block_desc)
......
......@@ -100,6 +100,12 @@ class TrtLayerAutoScanTest(AutoScanTest):
attrs=op_attr))
self.update_program_input_and_weight_with_attr(op_attr_list)
# if no weight need to save, we create a place_holder to help seriazlie params.
if not self.program_weights:
self.program_weights = {
"place_holder_weight": TensorConfig(
shape=[1], data=np.array([1]).astype(np.float32))
}
program_config = ProgramConfig(
ops=ops,
weights=self.program_weights,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册