chore: import upstream snapshot with attribution
Docker Image CI / build-ubuntu2004 (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:36:55 +08:00
commit c8a779b1bb
1887 changed files with 3245738 additions and 0 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,230 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// This file contains all Dims docstrings, since these are typically too long to keep in the binding code.
#pragma once
namespace tensorrt
{
namespace DataTypeDoc
{
constexpr const char* descr = R"trtdoc(
Represents data types.
:ivar itemsize: :class:`int` The size in bytes of this :class:`DataType` .
)trtdoc";
constexpr char const* float32 = R"trtdoc(32-bit floating point format.)trtdoc";
constexpr char const* float16 = R"trtdoc(IEEE 16-bit floating-point format.)trtdoc";
constexpr char const* bfloat16 = R"trtdoc(Brain float -- has an 8 bit exponent and 8 bit significand)trtdoc";
constexpr char const* int8 = R"trtdoc(Signed 8-bit integer representing a quantized floating-point value.)trtdoc";
constexpr char const* int32 = R"trtdoc(Signed 32-bit integer format.)trtdoc";
constexpr char const* int64 = R"trtdoc(Signed 64-bit integer format.)trtdoc";
constexpr char const* boolean = R"trtdoc(8-bit boolean. 0 = false, 1 = true, other values undefined.)trtdoc";
constexpr char const* uint8 = R"trtdoc(
Unsigned 8-bit integer format.
Cannot be used to represent quantized floating-point values.
Use the IdentityLayer to convert ``uint8`` network-level inputs to {``float32``, ``float16``} prior
to use with other TensorRT layers, or to convert intermediate output
before ``uint8`` network-level outputs from {``float32``, ``float16``} to ``uint8``.
``uint8`` conversions are only supported for {``float32``, ``float16``}.
``uint8`` to {``float32``, ``float16``} conversion will convert the integer values
to equivalent floating point values.
{``float32``, ``float16``} to ``uint8`` conversion will convert the floating point values
to integer values by truncating towards zero. This conversion has undefined behavior for
floating point values outside the range [0.0f, 256.0) after truncation.
``uint8`` conversions are not supported for {``int8``, ``int32``, ``bool``}.
)trtdoc";
constexpr char const* fp8 = R"trtdoc(
Signed 8-bit floating point with 1 sign bit, 4 exponent bits, 3 mantissa
bits, and exponent-bias 7.
)trtdoc";
constexpr char const* int4 = R"trtdoc(Signed 4-bit integer representing a quantized floating-point value.)trtdoc";
constexpr char const* fp4
= R"trtdoc(Signed 4-bit floating point with 1 sign bit, 2 exponent bits and 1 mantissa bits.)trtdoc";
constexpr char const* e8m0 = R"trtdoc(Unsigned 8-bit exponent-only floating point.)trtdoc";
} // namespace DataTypeDoc
namespace WeightsRoleDoc
{
constexpr const char* descr
= R"trtdoc(How a layer uses particular Weights. The power weights of an IScaleLayer are omitted. Refitting those is not supported.)trtdoc";
constexpr const char* KERNEL = R"trtdoc(Kernel for :class:`IConvolutionLayer` or :class:`IDeconvolutionLayer` .)trtdoc";
constexpr const char* BIAS = R"trtdoc(Bias for :class:`IConvolutionLayer` or :class:`IDeconvolutionLayer` .)trtdoc";
constexpr const char* SHIFT = R"trtdoc(Shift part of :class:`IScaleLayer` .)trtdoc";
constexpr const char* SCALE = R"trtdoc(Scale part of :class:`IScaleLayer` .)trtdoc";
constexpr const char* CONSTANT = R"trtdoc(Weights for :class:`IConstantLayer` .)trtdoc";
constexpr const char* ANY = R"trtdoc(Any other weights role.)trtdoc";
} // namespace WeightsRoleDoc
namespace WeightsDoc
{
constexpr const char* descr = R"trtdoc(
An array of weights used as a layer parameter.
The weights are held by reference until the engine has been built - deep copies are not made automatically.
:ivar dtype: :class:`DataType` The type of the weights.
:ivar size: :class:`int` The number of weights in the array.
:ivar nbytes: :class:`int` Total bytes consumed by the elements of the weights buffer.
)trtdoc";
// FIXME: Weird bug occurring here. Cannot provide :arg:
constexpr const char* init_type = R"trtdoc(
Initializes an empty (0-length) Weights object with the specified type.
:type: A type to initialize the weights with. Default: :class:`tensorrt.float32`
)trtdoc";
constexpr const char* init_ptr = R"trtdoc(
Initializes a Weights object with the specified data.
:type: A type to initialize the weights with.
:ptr: A pointer to the data.
:count: The number of weights.
)trtdoc";
// FIXME: Weird bug occurring here. Cannot provide :arg:
constexpr const char* init_numpy = R"trtdoc(
:a: A numpy array whose values to use. No deep copies are made.
)trtdoc";
constexpr const char* numpy = R"trtdoc(
Create a numpy array using the underlying buffer of this weights object.
The resulting array is just a view over the existing data, i.e. no deep copy is made.
If the weights cannot be converted to NumPy (e.g. due to unsupported data type), the original weights are returned.
:returns: The NumPy array or the original weights.
)trtdoc";
} // namespace WeightsDoc
namespace DimsDoc
{
constexpr const char* descr = R"trtdoc(
Structure to define the dimensions of a tensor. :class:`Dims` and all derived classes behave like Python :class:`tuple` s. Furthermore, the TensorRT API can implicitly convert Python iterables to :class:`Dims` objects, so :class:`tuple` or :class:`list` can be used in place of this class.
)trtdoc";
constexpr const char* volume = R"trtdoc(
Computes the total volume of the dimensions
:returns: Total volume. `0` for empty dimensions.
)trtdoc";
constexpr const char* get_type = R"trtdoc(
Queries the type of a dimension.
:returns: The type of the specified dimension.
)trtdoc";
constexpr const char* MAX_DIMS = R"trtdoc(
The maximum number of dimensions supported by :class:`Dims`.
)trtdoc";
} // namespace DimsDoc
namespace Dims2Doc
{
constexpr const char* descr = R"trtdoc(
Structure to define 2D shape.
)trtdoc";
} // namespace Dims2Doc
namespace DimsHWDoc
{
constexpr const char* descr = R"trtdoc(
Structure to define 2D shape with height and width.
:ivar h: :class:`int` The first dimension (height).
:ivar w: :class:`int` The second dimension (width).
)trtdoc";
} // namespace DimsHWDoc
namespace Dims3Doc
{
constexpr const char* descr = R"trtdoc(
Structure to define 3D shape.
)trtdoc";
} // namespace Dims3Doc
namespace DimsCHWDoc
{
constexpr const char* descr = R"trtdoc(
Structure to define 3D tensor with a channel dimension, height, and width.
:ivar c: :class:`int` The first dimension (channel).
:ivar h: :class:`int` The second dimension (height).
:ivar w: :class:`int` The third dimension (width).
)trtdoc";
} // namespace DimsCHWDoc
namespace Dims4Doc
{
constexpr const char* descr = R"trtdoc(
Structure to define 4D tensor.
)trtdoc";
} // namespace Dims4Doc
namespace IVersionedInterfaceDoc
{
constexpr const char* descr = R"trtdoc(
Base class for all versioned interfaces.
)trtdoc";
} // namespace IVersionedInterfaceDoc
namespace APILanguageDoc
{
constexpr const char* descr = R"trtdoc(
The language used in the implementation of a TensorRT interface.
)trtdoc";
} // namespace APILanguageDoc
namespace InterfaceInfoDoc
{
constexpr const char* descr = R"trtdoc(
Version information for a TensorRT interface.
)trtdoc";
} // namespace InterfaceInfoDoc
namespace DimsNCHWDoc
{
constexpr const char* descr = R"trtdoc(
Structure to define 4D tensor with a batch dimension, a channel dimension, height and width.
:ivar n: :class:`int` The first dimension (batch).
:ivar c: :class:`int` The second dimension (channel).
:ivar h: :class:`int` The third dimension (height).
:ivar w: :class:`int` The fourth dimension (width).
)trtdoc";
} // namespace DimsNCHWDoc
namespace IHostMemoryDoc
{
constexpr const char* descr = R"trtdoc(
Handles library allocated memory that is accessible to the user.
The memory allocated via the host memory object is owned by the library and will be de-allocated when object is destroyed.
This class exposes a buffer interface using Python's buffer protocol.
:ivar dtype: :class:`DataType` The data type of this buffer.
:ivar nbytes: :class:`int` Total bytes consumed by the elements of the buffer.
)trtdoc";
} // namespace IHostMemoryDoc
} // namespace tensorrt
File diff suppressed because it is too large Load Diff
+18
View File
@@ -0,0 +1,18 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
File diff suppressed because it is too large Load Diff
+388
View File
@@ -0,0 +1,388 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Docstrings for the pyOnnx parser bindings.
#pragma once
namespace tensorrt
{
namespace OnnxParserDoc
{
constexpr char const* descr = R"trtdoc(
This class is used for parsing ONNX models into a TensorRT network definition
:ivar num_errors: :class:`int` The number of errors that occurred during prior calls to :func:`parse`
)trtdoc";
constexpr char const* init = R"trtdoc(
:arg network: The network definition to which the parser will write.
:arg logger: The logger to use.
)trtdoc";
constexpr char const* parse = R"trtdoc(
Parse a serialized ONNX model into the TensorRT network.
:arg model: The serialized ONNX model.
:arg path: The path to the model file. Only required if the model has externally stored weights.
:returns: true if the model was parsed successfully
)trtdoc";
constexpr char const* parse_from_file = R"trtdoc(
Parse an ONNX model from file into a TensorRT network.
:arg model: The path to an ONNX model.
:returns: true if the model was parsed successfully
)trtdoc";
constexpr char const* supports_model_v2 = R"trtdoc(
Check whether TensorRT supports a particular ONNX model.
Query each subgraph with num_subgraphs, is_subgraph_supported, get_subgraph_nodes.
:arg model: The serialized ONNX model.
:arg path: The path to the model file. Only required if the model has externally stored weights.
:returns: true if the model is supported
)trtdoc";
constexpr char const* num_subgraphs = R"trtdoc(
Get the number of subgraphs. Calling before \p supportsModelV2 is an undefined behavior. Will return 0 by default.
:returns: Number of subgraphs
)trtdoc";
constexpr char const* is_subgraph_supported = R"trtdoc(
Returns whether the subgraph is supported. Calling before \p supportsModelV2 is an undefined behavior.
Will return false by default.
:arg index: Index of the subgraph to be checked.
:returns: true if subgraph is supported
)trtdoc";
constexpr char const* get_subgraph_nodes = R"trtdoc(
Get the nodes of the specified subgraph. Calling before \p supportsModelV2 is an undefined behavior.
Will return an empty list by default.
:arg index: Index of the subgraph.
:returns: List[int]
A list of node indices in the subgraph.
)trtdoc";
constexpr char const* supports_operator = R"trtdoc(
Returns whether the specified operator may be supported by the parser.
Note that a result of true does not guarantee that the operator will be supported in all cases (i.e., this function may return false-positives).
:arg op_name: The name of the ONNX operator to check for support
)trtdoc";
constexpr char const* get_error = R"trtdoc(
Get an error that occurred during prior calls to :func:`parse`
:arg index: Index of the error
)trtdoc";
constexpr char const* clear_errors = R"trtdoc(
Clear errors from prior calls to :func:`parse`
)trtdoc";
constexpr char const* clear_flag = R"trtdoc(
Clears the parser flag from the enabled flags.
:arg flag: The flag to clear.
)trtdoc";
constexpr char const* get_flag = R"trtdoc(
Check if a build mode flag is set.
:arg flag: The flag to check.
:returns: A `bool` indicating whether the flag is set.
)trtdoc";
constexpr char const* set_flag = R"trtdoc(
Add the input parser flag to the already enabled flags.
:arg flag: The flag to set.
)trtdoc";
constexpr char const* get_layer_output_tensor = R"trtdoc(
Get the i-th output ITensor object for the ONNX layer "name".
In the case of multiple nodes sharing the same name this function will return
the output tensors of the first instance of the node in the ONNX graph.
:arg name: The name of the ONNX layer.
:arg i: The index of the output.
:returns: The output tensor or None if the layer was not found or an invalid index was provided.
)trtdoc";
constexpr char const* get_used_vc_plugin_libraries = R"trtdoc(
Query the plugin libraries needed to implement operations used by the parser in a version-compatible engine.
This provides a list of plugin libraries on the filesystem needed to implement operations
in the parsed network. If you are building a version-compatible engine using this network,
provide this list to IBuilderConfig.set_plugins_to_serialize() to serialize these plugins along
with the version-compatible engine, or, if you want to ship these plugin libraries externally
to the engine, ensure that IPluginRegistry.load_library() is used to load these libraries in the
appropriate runtime before deserializing the corresponding engine.
:returns: List[str] List of plugin libraries found by the parser.
:raises: :class:`RuntimeError` if an internal error occurred when trying to fetch the list of plugin libraries.
)trtdoc";
constexpr char const* load_model_proto = R"trtdoc(
Load a serialized ONNX model into the parser. Unlike the parse() or parse_from_file()
functions, this function does not immediately convert the model into a TensorRT INetworkDefinition. Using this function
allows users to provide their own initializers for the ONNX model through the load_initializer() function.
Only one model can be loaded at a time. Subsequent calls to load_model_proto() will result in an error.
To begin the conversion of the model into a TensorRT INetworkDefinition, use parse_model_proto().
:arg model: The serialized ONNX model.
:arg path: The path to the model file. Only required if the model has externally stored weights.
:returns: true if the model was loaded successfully
)trtdoc";
constexpr char const* load_initializer = R"trtdoc(
Prompt the ONNX parser to load an initializer with user-provided binary data.
The lifetime of the data must exceed the lifetime of the parser.
All user-provided initializers must be provided prior to calling parse_model_proto().
This function can be called multiple times to specify the names of multiple initializers.
Calling this function with an initializer previously specified will overwrite the previous instance.
This function will return false if initializer validation fails. Possible validation errors are:
* This function was called prior to load_model_proto().
* The requested initializer was not found in the model.
* The size of the data provided is different from the corresponding initializer in the model.
:arg name: name of the initializer.
:arg data: binary data of the initializer.
:arg size: the size of the binary data.
:returns: true if the initializer was successfully loaded
)trtdoc";
constexpr char const* parse_model_proto = R"trtdoc(
Begin the parsing and conversion process of the loaded ONNX model into a TensorRT INetworkDefinition.
:returns: true if the model was parsed successfully.
)trtdoc";
constexpr char const* set_builder_config = R"trtdoc(
Set the BuilderConfig for the parser.
:arg builder_config: The BuilderConfig to set.
:returns: true if the BuilderConfig was set successfully, false otherwise.
)trtdoc";
} // namespace OnnxParserDoc
namespace OnnxParserRefitterDoc
{
constexpr char const* descr = R"trtdoc(
This is an interface designed to refit weights from an ONNX model.
)trtdoc";
constexpr char const* init = R"trtdoc(
:arg refitter: The Refitter object used to refit the model.
:arg logger: The logger to use.
)trtdoc";
constexpr char const* refit_from_bytes = R"trtdoc(
Load a serialized ONNX model from memory and perform weight refit.
:arg model: The serialized ONNX model.
:arg path: The path to the model file. Only required if the model has externally stored weights.
:returns: true if all the weights in the engine were refit successfully.
)trtdoc";
constexpr char const* refit_from_file = R"trtdoc(
Load and parse a ONNX model from disk and perform weight refit.
:arg model: The path to an ONNX model.
:returns: true if the model was loaded successfully, and if all the weights in the engine were refit successfully.
)trtdoc";
constexpr char const* get_error = R"trtdoc(
Get an error that occurred during prior calls to :func:`refitFromBytes` or :func:`refitFromFile`.
:arg index: Index of the error
)trtdoc";
constexpr char const* clear_errors = R"trtdoc(
Clear errors from prior calls to :func:`refitFromBytes` or :func:`refitFromFile`.
)trtdoc";
constexpr char const* load_model_proto = R"trtdoc(
Load a serialized ONNX model into the refitter. Unlike the refit() or refit_from_file()
functions, this function does not immediately begin the refit process. Using this function
allows users to provide their own initializers for the ONNX model through the load_initializer() function.
Only one model can be loaded at a time. Subsequent calls to load_model_proto() will result in an error.
To begin the refit process, use refit_model_proto().
:arg model: The serialized ONNX model.
:arg path: The path to the model file. Only required if the model has externally stored weights.
:returns: true if the model was loaded successfully.
)trtdoc";
constexpr char const* load_initializer = R"trtdoc(
Prompt the ONNX refitter to load an initializer with user-provided binary data.
The lifetime of the data must exceed the lifetime of the refitter.
All user-provided initializers must be provided prior to calling refit_model_proto().
This function can be called multiple times to specify the names of multiple initializers.
Calling this function with an initializer previously specified will overwrite the previous instance.
This function will return false if initializer validation fails. Possible validation errors are:
* This function was called prior to load_model_proto().
* The requested initializer was not found in the model.
* The size of the data provided is different from the corresponding initializer in the model.
:arg name: name of the initializer.
:arg data: binary data of the initializer.
:arg size: the size of the binary data.
:returns: true if the initializer was successfully loaded.
)trtdoc";
constexpr char const* refit_model_proto = R"trtdoc(
Begin the refit process from the loaded ONNX model.
:returns: true if the model was refit successfully.
)trtdoc";
} // namespace OnnxParserRefitterDoc
namespace ErrorCodeDoc
{
constexpr char const* descr = R"trtdoc(
The type of parser error
)trtdoc";
} // namespace ErrorCodeDoc
namespace OnnxParserFlagDoc
{
constexpr char const* descr = R"trtdoc(
Flags that control how an ONNX model gets parsed.
)trtdoc";
constexpr char const* NATIVE_INSTANCENORM = R"trtdoc(
Parse the ONNX model into the INetworkDefinition with the intention of using TensorRT's native layer implementation over the plugin implementation for InstanceNormalization nodes.
This flag is required when building version-compatible or hardware-compatible engines.
This flag is ON by default.
)trtdoc";
constexpr char const* ENABLE_UINT8_AND_ASYMMETRIC_QUANTIZATION_DLA = R"trtdoc(
Enable UINT8 as a quantization data type and asymmetric quantization with non-zero zero-point values in Quantize and Dequantize nodes.
The resulting engine must be built targeting DLA version >= 3.16.
This flag is OFF by default.
)trtdoc";
constexpr char const* REPORT_CAPABILITY_DLA = R"trtdoc(
Parse the ONNX model with per-node validation for DLA. If this flag is set, is_subgraph_supported() will
also return capability in the context of DLA support.
When this flag is set, a valid BuilderConfig must be provided to the parser via set_builder_config().
This flag is OFF by default.
)trtdoc";
constexpr char const* ENABLE_PLUGIN_OVERRIDE = R"trtdoc(
Allow a loaded plugin with the same name as an ONNX operator type to override the default ONNX implementation,
even if the plugin namespace attribute is not set.
This flag is useful for custom plugins that are intended to replace standard ONNX operators, for example to provide
alternative implementations or improved performance.
This flag is OFF by default.
)trtdoc";
constexpr char const* ADJUST_FOR_DLA = R"trtdoc(
Parse the ONNX model with adjustments to make layers more amenable to running on DLA.
This flag is OFF by default.
)trtdoc";
} // namespace OnnxParserFlagDoc
namespace ParserErrorDoc
{
constexpr char const* descr = R"trtdoc(
An object containing information about an error
)trtdoc";
constexpr char const* code = R"trtdoc(
:returns: The error code
)trtdoc";
constexpr char const* desc = R"trtdoc(
:returns: Description of the error
)trtdoc";
constexpr char const* file = R"trtdoc(
:returns: Source file in which the error occurred
)trtdoc";
constexpr char const* line = R"trtdoc(
:returns: Source line at which the error occurred
)trtdoc";
constexpr char const* func = R"trtdoc(
:returns: Source function in which the error occurred
)trtdoc";
constexpr char const* node = R"trtdoc(
:returns: Index of the Onnx model node in which the error occurred
)trtdoc";
constexpr char const* node_name = R"trtdoc(
:returns: Name of the node in the model in which the error occurred
)trtdoc";
constexpr char const* node_operator = R"trtdoc(
:returns: Name of the node operation in the model in which the error occurred
)trtdoc";
constexpr char const* local_function_stack = R"trtdoc(
:returns: Current stack trace of local functions in which the error occurred
)trtdoc";
constexpr char const* local_function_stack_size = R"trtdoc(
:returns: Size of the current stack trace of local functions in which the error occurred
)trtdoc";
} // namespace ParserErrorDoc
constexpr char const* get_nv_onnx_parser_version = R"trtdoc(
:returns: The Onnx Parser version
)trtdoc";
} // namespace tensorrt
+24
View File
@@ -0,0 +1,24 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 1993-2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Top level docstring, for the whole Python package.
#pragma once
namespace tensorrt
{
} // namespace tensorrt