TensorRT  7.2.1.6
NVIDIA TensorRT
Looking for a C++ dev who knows TensorRT?
I'm looking for work. Hire me!
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
onnx_graphsurgeon.ir.tensor.Variable Class Reference
Inheritance diagram for onnx_graphsurgeon.ir.tensor.Variable:
Collaboration diagram for onnx_graphsurgeon.ir.tensor.Variable:

Public Member Functions

def __init__ (self, str name, np.dtype dtype=None, Sequence[Union[int, str]] shape=None)
 
def to_constant (self, np.ndarray values)
 
def copy (self)
 
def __setattr__ (self, name, value)
 
def is_empty (self)
 
def to_variable (self, np.dtype dtype=None, Sequence[Union[int, str]] shape=[])
 
def i (self, tensor_idx=0, producer_idx=0)
 
def o (self, consumer_idx=0, tensor_idx=0)
 
def __str__ (self)
 
def __repr__ (self)
 
def __eq__ (self, other)
 

Static Public Member Functions

def empty ()
 

Public Attributes

 name
 
 inputs
 
 outputs
 
 dtype
 
 shape
 
 values
 

Static Public Attributes

int DYNAMIC = -1
 

Private Attributes

 __class__
 

Constructor & Destructor Documentation

◆ __init__()

def onnx_graphsurgeon.ir.tensor.Variable.__init__ (   self,
str  name,
np.dtype  dtype = None,
Sequence[Union[int, str]]  shape = None 
)
Represents a Tensor whose value is not known until inference-time.

Args:
    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.

Member Function Documentation

◆ empty()

def onnx_graphsurgeon.ir.tensor.Variable.empty ( )
static

◆ to_constant()

def onnx_graphsurgeon.ir.tensor.Variable.to_constant (   self,
np.ndarray  values 
)
Modifies this tensor in-place to convert it to a Constant. This means that all consumers/producers of the tensor will see the update.

Args:
    values (np.ndarray): The values in this tensor

Returns:
    self

Reimplemented from onnx_graphsurgeon.ir.tensor.Tensor.

◆ copy()

def onnx_graphsurgeon.ir.tensor.Variable.copy (   self)
Makes a shallow copy of this tensor, omitting input and output information.

Note: Generally, you should only ever make a deep copy of a Graph.

◆ __setattr__()

def onnx_graphsurgeon.ir.tensor.Tensor.__setattr__ (   self,
  name,
  value 
)
inherited

◆ is_empty()

def onnx_graphsurgeon.ir.tensor.Tensor.is_empty (   self)
inherited
Returns whether this tensor is considered empty in the graph.

*Note: 'Empty' here refers to the name of the tensor, which is omitted for
optional tensors, NOT the shape of the tensor*

Returns:
    bool: Whether the tensor is empty, meaning that it is used for an omitted optional input or output.

◆ to_variable()

def onnx_graphsurgeon.ir.tensor.Tensor.to_variable (   self,
np.dtype  dtype = None,
Sequence[Union[int, str]]  shape = [] 
)
inherited
Modifies this tensor in-place to convert it to a Variable. This means that all consumers/producers of the tensor will see the update.

Args:
    dtype (np.dtype): The data type of the tensor.
    shape (Sequence[int]): The shape of the tensor.

Returns:
    self

Reimplemented in onnx_graphsurgeon.ir.tensor.Constant.

◆ i()

def onnx_graphsurgeon.ir.tensor.Tensor.i (   self,
  tensor_idx = 0,
  producer_idx = 0 
)
inherited
Convenience function to get an input tensor of one of this tensor's input nodes.
Note that the parameters are swapped compared to the o() function; this is because tensors are likely to have only a single producer

For example:
::

    assert tensor.i() == tensor.inputs[0].inputs[0]
    assert tensor.i(1, 2) == tensor.inputs[2].inputs[1]

Args:
    tensor_idx (int): The index of the input tensor of the input node. Defaults to 0.
    producer_idx (int): The index of the producer node of the input tensor, if the tensor has multiple producers. Defaults to 0.

Returns:
    Tensor: The specified producer (input) tensor.

◆ o()

def onnx_graphsurgeon.ir.tensor.Tensor.o (   self,
  consumer_idx = 0,
  tensor_idx = 0 
)
inherited
Convenience function to get an output tensor of one of this tensor's output nodes.

For example:
::

    assert tensor.o() == tensor.outputs[0].outputs[0]
    assert tensor.o(2, 1) == tensor.outputs[2].outputs[1]

Args:
    consumer_idx (int): The index of the consumer of the input tensor. Defaults to 0.
    tensor_idx (int): The index of the output tensor of the node, if the node has multiple outputs. Defaults to 0.

Returns:
    Tensor: The specified consumer (output) tensor

◆ __str__()

def onnx_graphsurgeon.ir.tensor.Tensor.__str__ (   self)
inherited
Here is the caller graph for this function:

◆ __repr__()

def onnx_graphsurgeon.ir.tensor.Tensor.__repr__ (   self)
inherited

Reimplemented in onnx_graphsurgeon.ir.tensor.Constant.

Here is the call graph for this function:

◆ __eq__()

def onnx_graphsurgeon.ir.tensor.Tensor.__eq__ (   self,
  other 
)
inherited
Perform a check to see if two tensors are equal.

Tensors are considered equal if they share the same name. A Graph must not include Tensors with duplicate names.

Member Data Documentation

◆ name

onnx_graphsurgeon.ir.tensor.Variable.name

◆ inputs

onnx_graphsurgeon.ir.tensor.Variable.inputs

◆ outputs

onnx_graphsurgeon.ir.tensor.Variable.outputs

◆ dtype

onnx_graphsurgeon.ir.tensor.Variable.dtype

◆ shape

onnx_graphsurgeon.ir.tensor.Variable.shape

◆ DYNAMIC

int onnx_graphsurgeon.ir.tensor.Tensor.DYNAMIC = -1
staticinherited

◆ __class__

onnx_graphsurgeon.ir.tensor.Tensor.__class__
privateinherited

◆ values

onnx_graphsurgeon.ir.tensor.Tensor.values
inherited

The documentation for this class was generated from the following file: