完整警告和报错信息:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:219: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
torch.tensor(output_scale.clone().detach(), dtype=torch.float32),
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/qtensor.py:1068: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if scale is not None and scale.numel() > 1:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/conv2d.py:290: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
per_channel_axis=-1 if self.out_scale.numel() == 1 else 1,
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/utils/script_quantized_fn.py:239: UserWarning: operator() profile_node %204 : int = prim::profile_ivalue(%_storage_type)
does not have profile information (Triggered internally at ../torch/csrc/jit/codegen/cuda/graph_fuser.cpp:105.)
return compiled_fn(*args, **kwargs)
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:317: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
self.inverse_func(
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:336: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if self.is_centrosymmetric and input_float_min < 0:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:24: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
start = start.item()
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:27: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
stop = stop.item()
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:30: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
step = step.item()
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:363: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if input_float_min == dividing_points[0]:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:53: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if diffx == 0:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:94: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
max_right_shift = max(
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:97: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if right_shift > max_right_shift:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:104: TracerWarning: Converting a tensor to a Python number might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
b / output_scale * (1
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:384: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if input_float_max == dividing_points[-1]:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/functional_modules.py:163: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
per_channel_axis=-1 if self.scale.numel() == 1 else 1,
/usr/local/lib/python3.8/dist-packages/hat/models/base_modules/attention.py:155: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if attn_mask.shape != correct_4d_size:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:139: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if ddy.isnan().sum() > 0:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:147: TracerWarning: Iterating over a tensor might cause the trace to be incorrect. Passing a tensor of different shape won't change the number of iterations executed (and might lead to errors or silently give incorrect results).
for i, p in zip(segment_idx + 1, x[1:]):
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:148: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if i > 6:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:150: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if i > dividing_points.numel():
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:154: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage would be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results.
if len(dividing_points) < 6:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/nn/quantized/segment_lut.py:161: TracerWarning: Using len to get tensor shape might cause the trace to be incorrect. Recommended usage would be tensor.shape[0]. Passing a tensor of different shape might lead to errors or silently give incorrect results.
tail_list = [input_float_max.reshape(1)] * (7 - len(dividing_points))
/usr/local/lib/python3.8/dist-packages/hat/models/base_modules/attention.py:92: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert (
/usr/local/lib/python3.8/dist-packages/hat/models/base_modules/attention.py:97: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
key.shape == value.shape
/usr/local/lib/python3.8/dist-packages/hat/models/base_modules/attention.py:143: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if attn_mask.shape != correct_3d_size:
/usr/local/lib/python3.8/dist-packages/hat/models/base_modules/attention.py:229: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if attn_mask.shape[2] != 1:
/usr/local/lib/python3.8/dist-packages/horizon_plugin_pytorch/qtensor.py:835: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert input.q_scale().numel() == 1, "only support per-tensor scale!"
/usr/local/lib/python3.8/dist-packages/hat/models/task_modules/motion_forecasting/decoders/densetnt/head.py:218: TracerWarning: torch.from_numpy results are registered as constants in the trace. You can safely ignore this warning if you use this function to create tensors out of constant variables that would be the same every time you call this function. In any other case, this might cause the trace to be incorrect.
delta_list = torch.from_numpy(delta_list).to(torch.float32).unsqueeze(0).unsqueeze(-1).unsqueeze(-1)
WARNING: found duplicate layer names "_hz_matmul_torch_native". rename to "_hz_matmul_torch_native.1"
Traceback (most recent call last):
File "tools/model_checker.py", line 84, in
model_checker(args.config, args_env=args_env)
File "tools/model_checker.py", line 64, in model_checker
flag = check_model(deploy_model, deploy_inputs, advice=10)
File "/usr/local/lib/python3.8/dist-packages/hbdk/torch_script/tools.py", line 162, in check_model
export_hbir(module, example_inputs, hbir_file.name, march)
File "/usr/local/lib/python3.8/dist-packages/hbdk/torch_script/tools.py", line 112, in export_hbir
builder.build_from_jit(script_module, example_inputs)
File "/usr/local/lib/python3.8/dist-packages/hbdk/torch_script/parser.py", line 294, in build_from_jit
self._build_from_jit_script(jit_obj, example_inputs)
File "/usr/local/lib/python3.8/dist-packages/hbdk/torch_script/parser.py", line 263, in _build_from_jit_script
self._visit_node(node)
File "/usr/local/lib/python3.8/dist-packages/hbdk/torch_script/parser.py", line 121, in _visit_node
raise ValueError('unsupported node', node, 'in named children',
ValueError: ('unsupported node', %1099 : Tensor = aten::add(%1047, %dense_goal0.1, %564) # /usr/local/lib/python3.8/dist-packages/hat/models/task_modules/motion_forecasting/decoders/densetnt/head.py:229:0
, 'in named children', '')
报错位置的代码:
dense_goal_add = sparse_goals + dense_goal
用torch.add也试过还是报错