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

Method add

tools/Polygraphy/polygraphy/common/struct.py:96–120  ·  view source on GitHub ↗

Convenience function for adding entries. Args: name (str): The name of the input. dtype (numpy.dtype): The data type of the input. shape (Sequence[Union[int, str]]]): The shape of the input. Dynamic dimensions may

(self, name, dtype, shape, min_shape=None, max_shape=None)

Source from the content-addressed store, hash-verified

94 return meta
95
96 def add(self, name, dtype, shape, min_shape=None, max_shape=None):
97 """
98 Convenience function for adding entries.
99
100 Args:
101 name (str): The name of the input.
102 dtype (numpy.dtype): The data type of the input.
103 shape (Sequence[Union[int, str]]]):
104 The shape of the input. Dynamic dimensions may
105 be indicated by negative values, ``None``, or a string.
106
107 min_shape (Sequence[int]):
108 The minimum valid shape for the input.
109 If provided, this shape should not include any dynamic dimensions.
110 max_shape (Sequence[int]):
111 The maximum valid shape for the input.
112 If provided, this shape should not include any dynamic dimensions.
113
114 Returns:
115 The newly added entry.
116 """
117 self[name] = MetadataTuple(
118 dtype, BoundedShape(shape, min=min_shape, max=max_shape) if shape is not None else None
119 )
120 return self
121
122 def __repr__(self):
123 ret = "TensorMetadata()"

Callers 15

missing_meta_tensorsMethod · 0.95
meta_from_iter_resultMethod · 0.95
parse_metaFunction · 0.95
get_metadata_from_engineFunction · 0.95

Calls 2

MetadataTupleClass · 0.85
BoundedShapeClass · 0.85

Tested by

no test coverage detected