MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / main

Function main

samples/python/onnx_custom_plugin/test_custom_hardmax_plugin.py:71–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69 return output
70
71def main():
72 load_plugin_lib()
73 for num_dims in range(1, 8):
74 for axis in range(-num_dims, num_dims):
75 shape = np.random.randint(1, 4, size=num_dims)
76 arr = np.random.rand(*shape)
77 arr = (arr - 0.5) * 200
78 engine = make_trt_network_and_engine(shape, axis)
79 res1 = hardmax_reference_impl(arr, axis)
80 res2 = custom_plugin_impl(arr, engine).reshape(res1.shape)
81 assert np.all(res1 == res2), f"Test failed for shape={shape}, axis={axis}"
82 print("Passed")
83
84if __name__ == '__main__':
85 main()

Callers 1

Calls 5

load_plugin_libFunction · 0.90
hardmax_reference_implFunction · 0.85
custom_plugin_implFunction · 0.85
printFunction · 0.85

Tested by

no test coverage detected