You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: python/paddle/tensorrt/export.py
+67-60Lines changed: 67 additions & 60 deletions
Original file line number
Diff line number
Diff line change
@@ -51,56 +51,6 @@
51
51
52
52
53
53
classInput:
54
-
"""
55
-
A class used to configure input data for models. This class serves two purposes:
56
-
57
-
1. Random Data Generation: When no input data is supplied, it automatically generates random input data based on the specified minimum, optimal, and maximum shapes. In this mode,you can configure the data type (e.g., 'float32', 'int64', etc.) and the range of values (e.g.,(0.0, 1.0) for floats or (1, 10) for integers).
58
-
59
-
2. User-Provided Input: Alternatively, you can supply your own input data via the `warmup_data` argument. In this case, the provided data will be used directly, and the`input_data_type` and `input_range` settings will be ignored.
60
-
61
-
Args:
62
-
warmup_data (tuple):
63
-
The tuple of actual input data (for the automatic shape collection mechanism).
64
-
min_input_shape (tuple):
65
-
The shape of the minimum input tensor.
66
-
max_input_shape (tuple):
67
-
The shape of the maximum input tensor.
68
-
optim_input_shape (tuple, optional):
69
-
The shape of the optimal input tensor (default is None).
70
-
input_data_type (str, optional):
71
-
The data type for the input tensors, such as 'float32' or 'int64' or 'float32' or 'int32' (default is float32).
72
-
This option only applies when min_input_shape, optim_input_shape, and max_input_shape are provided; it does not apply to warmup_data.
73
-
input_range (tuple, optional):
74
-
The range of values used to generate input data. For floats, the default range is (0.0, 1.0). For integers, the default range is (1, 10).
75
-
This option only applies when min_input_shape, optim_input_shape, and max_input_shape are provided; it does not apply to warmup_data.
76
-
Returns:
77
-
None
78
-
79
-
Examples:
80
-
.. code-block:: python
81
-
82
-
>>> # example 1:
83
-
>>> from paddle.tensorrt.export import Input
84
-
>>> input_config = Input(
85
-
>>> min_input_shape=(1,100),
86
-
>>> optim_input_shape=(4,100),
87
-
>>> max_input_shape=(8,100),
88
-
>>> )
89
-
>>> input_config.input_data_type='int64'
90
-
>>> input_config.input_range=(1,10)
91
-
92
-
>>> # example 2:
93
-
>>> from paddle.tensorrt.export import Input
94
-
>>> import numpy as np
95
-
>>> input_config = Input(
96
-
>>> warmup_data=(
97
-
>>> np.random.rand(1,100).astype(np.float32),
98
-
>>> np.random.rand(4,100).astype(np.float32),
99
-
>>> np.random.rand(8,100).astype(np.float32),
100
-
>>> )
101
-
>>> )
102
-
"""
103
-
104
54
def__init__(
105
55
self,
106
56
warmup_data: tuple[np.ndarray, ...] |None=None,
@@ -109,7 +59,59 @@ def __init__(
109
59
optim_input_shape: tuple|None=None,
110
60
input_data_type: str|None='float32',
111
61
input_range: tuple|None=None,
62
+
name: str|None=None,
112
63
) ->None:
64
+
"""
65
+
A class used to configure input data for models. This class serves two purposes:
66
+
67
+
1. Random Data Generation: When no input data is supplied, it automatically generates random input data based on the specified minimum, optimal, and maximum shapes. In this mode,you can configure the data type (e.g., 'float32', 'int64', etc.) and the range of values (e.g.,(0.0, 1.0) for floats or (1, 10) for integers).
68
+
69
+
2. User-Provided Input: Alternatively, you can supply your own input data via the `warmup_data` argument. In this case, the provided data will be used directly, and the`input_data_type` and `input_range` settings will be ignored.
70
+
71
+
Args:
72
+
warmup_data (tuple):
73
+
The tuple of actual input data (for the automatic shape collection mechanism).
74
+
min_input_shape (tuple):
75
+
The shape of the minimum input tensor.
76
+
max_input_shape (tuple):
77
+
The shape of the maximum input tensor.
78
+
optim_input_shape (tuple):
79
+
The shape of the optimal input tensor.
80
+
input_data_type (str, optional):
81
+
The data type for the input tensors, such as 'float32' or 'int64' or 'float32' or 'int32' (default is float32).
82
+
This option only applies when min_input_shape, optim_input_shape, and max_input_shape are provided; it does not apply to warmup_data.
83
+
input_range (tuple, optional):
84
+
The range of values used to generate input data. For floats, the default range is (0.0, 1.0). For integers, the default range is (1, 10).
85
+
This option only applies when min_input_shape, optim_input_shape, and max_input_shape are provided; it does not apply to warmup_data.
0 commit comments