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.Tensor Class Reference
Inheritance diagram for onnx_graphsurgeon.ir.tensor.Tensor:
Collaboration diagram for onnx_graphsurgeon.ir.tensor.Tensor:

Public Member Functions

def __init__ (self)
 
def __setattr__ (self, name, value)
 
def is_empty (self)
 
def to_constant (self, np.ndarray values)
 
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)
 

Public Attributes

 name
 
 values
 
 dtype
 
 shape
 

Static Public Attributes

int DYNAMIC = -1
 

Private Attributes

 __class__
 

Detailed Description

Abstract base class for tensors in a graph

Constructor & Destructor Documentation

◆ __init__()

def onnx_graphsurgeon.ir.tensor.Tensor.__init__ (   self)
**This class is abstract and cannot be constructed directly.**

Member Function Documentation

◆ __setattr__()

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

◆ is_empty()

def onnx_graphsurgeon.ir.tensor.Tensor.is_empty (   self)
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_constant()

def onnx_graphsurgeon.ir.tensor.Tensor.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 in onnx_graphsurgeon.ir.tensor.Variable.

◆ to_variable()

def onnx_graphsurgeon.ir.tensor.Tensor.to_variable (   self,
np.dtype  dtype = None,
Sequence[Union[int, str]]  shape = [] 
)
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 
)
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 
)
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)
Here is the caller graph for this function:

◆ __repr__()

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

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 
)
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

◆ DYNAMIC

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

◆ name

onnx_graphsurgeon.ir.tensor.Tensor.name

◆ __class__

onnx_graphsurgeon.ir.tensor.Tensor.__class__
private

◆ values

onnx_graphsurgeon.ir.tensor.Tensor.values

◆ dtype

onnx_graphsurgeon.ir.tensor.Tensor.dtype

◆ shape

onnx_graphsurgeon.ir.tensor.Tensor.shape

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