Variable¶
-
class
onnx_graphsurgeon.
Variable
(name: str, dtype: numpy.dtype = None, shape: Sequence[Union[int, str]] = None)¶ Bases:
onnx_graphsurgeon.ir.tensor.Tensor
Represents a Tensor whose value is not known until inference-time.
- Parameters
name (str) – The name of the tensor.
dtype (numpy.dtype) – The data type of the tensor.
shape (Sequence[Union[int, str]]) – The shape of the tensor. This may contain strings if the model uses dimension parameters.
-
to_constant
(values: numpy.ndarray)¶ Modifies this tensor in-place to convert it to a Constant. This means that all consumers/producers of the tensor will see the update.
- Parameters
values (np.ndarray) – The values in this tensor
data_location (int) – An enum value indicating the location where the tensor data is stored. Generally, this will come from onnx.TensorProto.DataLocation.
- Returns
self
-
copy
()¶ Makes a shallow copy of this tensor, omitting input and output information.
Note: Generally, you should only ever make a copy of a Graph.