TensorRT Python API giving segmentation fault

Hello,

I am trying to build a network manually using the TensorRT Python API with the code below but i get “Segmentation fault (core dumped)”. What am I doing wrong?
Thanks.

import tensorrt as trt
import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np

G_LOGGER = trt.infer.ConsoleLogger(trt.infer.LogSeverity.INFO)
builder = trt.infer.create_infer_builder(G_LOGGER)

network = builder.create_network()

data = network.add_input("data", trt.infer.DataType.FLOAT, (3, 416, 416))
assert(data)

conv1_w = np.random.randn(3 * 3 * 3 * 32)
conv1_b = np.random.rand(32)
conv1 = network.add_convolution(data, 32, (3,3), conv1_w, None)
assert(conv1)
conv1.set_stride((1,1))

Hi,

I had the same problem.
Try rewriting lines 14-15:

conv1_w = np.random.randn(3 * 3 * 3 * 32).astype(np.float32)
conv1_b = np.random.rand(32).astype(np.float32)

Thanks, that worked!

I’ve got Segmentation fault when I tried to examine one sample(yolov3_onnx).
When I try to import packages in order below, I get Segmentation fault. It’s weird.

import tensorrt as trt
from yolov3_to_onnx import download_file

hi sungwonida

i got the same problem. have u solved it?

I have the same problem