Skip to content

Numpy deprecated function name #3

Description

@simon-bonin

Getting error while converting tensorrt model to Onnx.

Seems to be numpy.product function is now numpy.prod with numpy 2.0

~# python3 yolo_to_onnx.py -m yolov7-320

Parsing DarkNet cfg file...
Building ONNX graph...
Traceback (most recent call last):
File "/root/tensorrt_demos/yolo/yolo_to_onnx.py", line 1065, in
main()
~~~~^^
File "/root/tensorrt_demos/yolo/yolo_to_onnx.py", line 1050, in main
yolo_model_def = builder.build_onnx_graph(
layer_configs=layer_configs,
weights_file_path=weights_file_path,
verbose=True)
File "/root/tensorrt_demos/yolo/yolo_to_onnx.py", line 584, in build_onnx_graph
initializer_layer, inputs_layer = weight_loader.load_conv_weights(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
params)
^^^^^^^
File "/root/tensorrt_demos/yolo/yolo_to_onnx.py", line 441, in load_conv_weights
bias_init, bias_input = self._create_param_tensors(
~~~~~~~~~~~~~~~~~~~~~~~~~~^
conv_params, 'bn', 'bias')
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/tensorrt_demos/yolo/yolo_to_onnx.py", line 486, in _create_param_tensors
param_name, param_data, param_data_shape = self._load_one_param_type(
~~~~~~~~~~~~~~~~~~~~~~~~~^
conv_params, param_category, suffix)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/tensorrt_demos/yolo/yolo_to_onnx.py", line 513, in _load_one_param_type
param_size = np.product(np.array(param_shape))
^^^^^^^^^^
File "/usr/lib/python3/dist-packages/numpy/init.py", line 414, in getattr
raise AttributeError("module {!r} has no attribute "
"{!r}".format(name, attr))
AttributeError: module 'numpy' has no attribute 'product

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions