Functions
ngraph.opset3.ops Namespace Reference

Functions

Node assign (NodeInput new_value, str variable_id, Optional[str] name=None)
 Return a node which produces the Assign operation. More...
 
Node broadcast (NodeInput data, NodeInput target_shape, Optional[NodeInput] axes_mapping=None, str broadcast_spec="NUMPY", Optional[str] name=None)
 Create a node which broadcasts the input node's values along specified axes to a desired shape. More...
 
Node bucketize (Node data, NodeInput buckets, str output_type="i64", bool with_right_bound=True, Optional[str] name=None)
 Return a node which produces the Bucketize operation. More...
 
Node cum_sum (NodeInput arg, NodeInput axis, bool exclusive=False, bool reverse=False, Optional[str] name=None)
 Construct a cumulative summation operation. More...
 
Node embedding_bag_offsets_sum (Node emb_table, NodeInput indices, NodeInput offsets, Optional[NodeInput] default_index=None, Optional[NodeInput] per_sample_weights=None, Optional[str] name=None)
 Return a node which performs sums of bags of embeddings without the intermediate embeddings. More...
 
Node embedding_bag_packed_sum (NodeInput emb_table, NodeInput indices, Optional[NodeInput] per_sample_weights=None, Optional[str] name=None)
 Return an EmbeddingBagPackedSum node. More...
 
Node embedding_segments_sum (Node emb_table, NodeInput indices, NodeInput segment_ids, Optional[NodeInput] num_segments=None, Optional[NodeInput] default_index=None, Optional[NodeInput] per_sample_weights=None, Optional[str] name=None)
 Return an EmbeddingSegmentsSum node. More...
 
Node extract_image_patches (NodeInput image, TensorShape sizes, List[int] strides, TensorShape rates, str auto_pad, Optional[str] name=None)
 Return a node which produces the ExtractImagePatches operation. More...
 
Node gru_cell (NodeInput X, NodeInput initial_hidden_state, NodeInput W, NodeInput R, NodeInput B, int hidden_size, List[str] activations=None, List[float] activations_alpha=None, List[float] activations_beta=None, float clip=0.0, bool linear_before_reset=False, Optional[str] name=None)
 Perform GRUCell operation on the tensor from input node. More...
 
Node non_max_suppression (NodeInput boxes, NodeInput scores, Optional[NodeInput] max_output_boxes_per_class=None, Optional[NodeInput] iou_threshold=None, Optional[NodeInput] score_threshold=None, str box_encoding="corner", bool sort_result_descending=True, str output_type="i64", Optional[str] name=None)
 Return a node which performs NonMaxSuppression. More...
 
Node non_zero (NodeInput data, str output_type="i64", Optional[str] name=None)
 Return the indices of the elements that are non-zero. More...
 
Node read_value (NodeInput init_value, str variable_id, Optional[str] name=None)
 Return a node which produces the Assign operation. More...
 
Node rnn_cell (NodeInput X, NodeInput initial_hidden_state, NodeInput W, NodeInput R, NodeInput B, int hidden_size, List[str] activations, List[float] activations_alpha, List[float] activations_beta, float clip=0.0, Optional[str] name=None)
 Perform RNNCell operation on tensor from input node. More...
 
Node roi_align (NodeInput data, NodeInput rois, NodeInput batch_indices, int pooled_h, int pooled_w, int sampling_ratio, float spatial_scale, str mode, Optional[str] name=None)
 Return a node which performs ROIAlign. More...
 
Node scatter_elements_update (NodeInput data, NodeInput indices, NodeInput updates, NodeInput axis, Optional[str] name=None)
 Return a node which produces a ScatterElementsUpdate operation. More...
 
Node scatter_update (Node data, NodeInput indices, NodeInput updates, NodeInput axis, Optional[str] name=None)
 Return a node which produces a ScatterUpdate operation. More...
 
Node shape_of (NodeInput data, str output_type="i64", Optional[str] name=None)
 Return a node which produces a tensor containing the shape of its input data. More...
 
Node shuffle_channels (Node data, int axis, int groups, Optional[str] name=None)
 Perform permutation on data in the channel dimension of the input tensor. More...
 
Node topk (NodeInput data, NodeInput k, int axis, str mode, str sort, str index_element_type="i32", Optional[str] name=None)
 Return a node which performs TopK. More...
 

Function Documentation

◆ assign()

Node ngraph.opset3.ops.assign ( NodeInput  new_value,
str  variable_id,
Optional[str]   name = None 
)

Return a node which produces the Assign operation.

@param new_value:    Node producing a value to be assigned to a variable.
@param variable_id:  Id of a variable to be updated.
@param name:         Optional name for output node.
@return Assign node

◆ broadcast()

Node ngraph.opset3.ops.broadcast ( NodeInput  data,
NodeInput  target_shape,
Optional[NodeInput]   axes_mapping = None,
str   broadcast_spec = "NUMPY",
Optional[str]   name = None 
)

Create a node which broadcasts the input node's values along specified axes to a desired shape.

@param data: The node with input tensor data.
@param target_shape: The node with a new shape we want to broadcast tensor to.
@param axes_mapping: The node with a axis positions (0-based) in the result
                       that are being broadcast.
@param broadcast_spec: The type of broadcasting that specifies mapping of input tensor axes
                       to output shape axes. Range of values: NUMPY, EXPLICIT, BIDIRECTIONAL.
@param name: Optional new name for output node.
@return New node with broadcast shape.

◆ bucketize()

Node ngraph.opset3.ops.bucketize ( Node  data,
NodeInput  buckets,
str   output_type = "i64",
bool   with_right_bound = True,
Optional[str]   name = None 
)

Return a node which produces the Bucketize operation.

@param data:              Input data to bucketize
@param buckets:           1-D of sorted unique boundaries for buckets
@param output_type:       Output tensor type, "i64" or "i32", defaults to i64
@param with_right_bound:  indicates whether bucket includes the right or left
                          edge of interval. default true = includes right edge
@param name:              Optional name for output node.
@return Bucketize node

◆ cum_sum()

Node ngraph.opset3.ops.cum_sum ( NodeInput  arg,
NodeInput  axis,
bool   exclusive = False,
bool   reverse = False,
Optional[str]   name = None 
)

Construct a cumulative summation operation.

@param arg: The tensor to be summed.
@param axis: zero dimension tensor specifying axis position along which sum will be performed.
@param exclusive: if set to true, the top element is not included
@param reverse: if set to true, will perform the sums in reverse direction
@return New node performing the operation

◆ embedding_bag_offsets_sum()

Node ngraph.opset3.ops.embedding_bag_offsets_sum ( Node  emb_table,
NodeInput  indices,
NodeInput  offsets,
Optional[NodeInput]   default_index = None,
Optional[NodeInput]   per_sample_weights = None,
Optional[str]   name = None 
)

Return a node which performs sums of bags of embeddings without the intermediate embeddings.

@param emb_table: Tensor containing the embedding lookup table.
@param indices: Tensor with indices.
@param offsets: Tensor containing the starting index positions of each bag in indices.
@param per_sample_weights: Tensor with weights for each sample.
@param default_index: Scalar containing default index in embedding table to fill empty bags.
@param name: Optional name for output node.
@return The new node which performs EmbeddingBagOffsetsSum

◆ embedding_bag_packed_sum()

Node ngraph.opset3.ops.embedding_bag_packed_sum ( NodeInput  emb_table,
NodeInput  indices,
Optional[NodeInput]   per_sample_weights = None,
Optional[str]   name = None 
)

Return an EmbeddingBagPackedSum node.

EmbeddingSegmentsSum constructs an output tensor by replacing every index in a given
input tensor with a row (from the weights matrix) at that index

@param emb_table: Tensor containing the embedding lookup table.
@param indices: Tensor with indices.
@param per_sample_weights: Weights to be multiplied with embedding table.
@param name: Optional name for output node.
@return EmbeddingBagPackedSum node

◆ embedding_segments_sum()

Node ngraph.opset3.ops.embedding_segments_sum ( Node  emb_table,
NodeInput  indices,
NodeInput  segment_ids,
Optional[NodeInput]   num_segments = None,
Optional[NodeInput]   default_index = None,
Optional[NodeInput]   per_sample_weights = None,
Optional[str]   name = None 
)

Return an EmbeddingSegmentsSum node.

EmbeddingSegmentsSum constructs an output tensor by replacing every index in a given
input tensor with a row (from the weights matrix) at that index

@param emb_table: Tensor containing the embedding lookup table.
@param indices: Tensor with indices.
@param segment_ids: Tensor with indices into the output Tensor
@param num_segments: Tensor with number of segments.
@param default_index: Scalar containing default index in embedding table to fill empty bags.
@param per_sample_weights: Weights to be multiplied with embedding table.
@param name: Optional name for output node.
@return EmbeddingSegmentsSum node

◆ extract_image_patches()

Node ngraph.opset3.ops.extract_image_patches ( NodeInput  image,
TensorShape  sizes,
List[int]  strides,
TensorShape  rates,
str  auto_pad,
Optional[str]   name = None 
)

Return a node which produces the ExtractImagePatches operation.

@param image:     4-D Input data to extract image patches.
@param sizes:     Patch size in the format of [size_rows, size_cols].
@param strides:   Patch movement stride in the format of [stride_rows, stride_cols]
@param rates:     Element seleciton rate for creating a patch.
@param auto_pad:  Padding type.
@param name:      Optional name for output node.
@return ExtractImagePatches node

◆ gru_cell()

Node ngraph.opset3.ops.gru_cell ( NodeInput  X,
NodeInput  initial_hidden_state,
NodeInput  W,
NodeInput  R,
NodeInput  B,
int  hidden_size,
List[str]   activations = None,
List[float]   activations_alpha = None,
List[float]   activations_beta = None,
float   clip = 0.0,
bool   linear_before_reset = False,
Optional[str]   name = None 
)

Perform GRUCell operation on the tensor from input node.

GRUCell represents a single GRU Cell that computes the output
using the formula described in the paper: https://arxiv.org/abs/1406.1078

Note this class represents only single *cell* and not whole *layer*.

@param X:                       The input tensor with shape: [batch_size, input_size].
@param initial_hidden_state:    The hidden state tensor at current time step with shape:
                                [batch_size, hidden_size].
@param W:                       The weights for matrix multiplication, gate order: zrh.
                                Shape: [3*hidden_size, input_size].
@param R:                       The recurrence weights for matrix multiplication.
                                Shape: [3*hidden_size, hidden_size].
@param B:                       The sum of biases (weight and recurrence).
                                For linear_before_reset set True the shape is [4*hidden_size].
                                Otherwise the shape is [3*hidden_size].
@param hidden_size:             The number of hidden units for recurrent cell.
                                Specifies hidden state size.
@param activations:             The vector of activation functions used inside recurrent cell.
@param activation_alpha:        The vector of alpha parameters for activation functions in
                                order respective to activation list.
@param activation_beta:         The vector of beta parameters for activation functions in order
                                respective to activation list.
@param clip:                    The value defining clipping range [-clip, clip] on input of
                                activation functions.
@param linear_before_reset:     Flag denotes if the layer behaves according to the modification
                                of GRUCell described in the formula in the ONNX documentation.
@param name:                    Optional output node name.
@return   The new node performing a GRUCell operation on tensor from input node.

◆ non_max_suppression()

Node ngraph.opset3.ops.non_max_suppression ( NodeInput  boxes,
NodeInput  scores,
Optional[NodeInput]   max_output_boxes_per_class = None,
Optional[NodeInput]   iou_threshold = None,
Optional[NodeInput]   score_threshold = None,
str   box_encoding = "corner",
bool   sort_result_descending = True,
str   output_type = "i64",
Optional[str]   name = None 
)

Return a node which performs NonMaxSuppression.

@param boxes: Tensor with box coordinates.
@param scores: Tensor with box scores.
@param max_output_boxes_per_class: Tensor Specifying maximum number of boxes
                                    to be selected per class.
@param iou_threshold: Tensor specifying intersection over union threshold
@param score_threshold: Tensor specifying minimum score to consider box for the processing.
@param box_encoding: Format of boxes data encoding.
@param sort_result_descending: Flag that specifies whenever it is necessary to sort selected
                               boxes across batches or not.
@param output_type: Output element type.
@return The new node which performs NonMaxSuppression

◆ non_zero()

Node ngraph.opset3.ops.non_zero ( NodeInput  data,
str   output_type = "i64",
Optional[str]   name = None 
)

Return the indices of the elements that are non-zero.

@param data: Input data.
@param output_type: Output tensor type.

@return The new node which performs NonZero

◆ read_value()

Node ngraph.opset3.ops.read_value ( NodeInput  init_value,
str  variable_id,
Optional[str]   name = None 
)

Return a node which produces the Assign operation.

@param init_value:   Node producing a value to be returned instead of an unassigned variable.
@param variable_id:  Id of a variable to be read.
@param name:         Optional name for output node.
@return ReadValue node

◆ rnn_cell()

Node ngraph.opset3.ops.rnn_cell ( NodeInput  X,
NodeInput  initial_hidden_state,
NodeInput  W,
NodeInput  R,
NodeInput  B,
int  hidden_size,
List[str]  activations,
List[float]  activations_alpha,
List[float]  activations_beta,
float   clip = 0.0,
Optional[str]   name = None 
)

Perform RNNCell operation on tensor from input node.

It follows notation and equations defined as in ONNX standard:
https://github.com/onnx/onnx/blob/master/docs/Operators.md#RNN

Note this class represents only single *cell* and not whole RNN *layer*.

@param X:                       The input tensor with shape: [batch_size, input_size].
@param initial_hidden_state:    The hidden state tensor at current time step with shape:
                                [batch_size, hidden_size].
@param W:                       The weight tensor with shape: [hidden_size, input_size].
@param R:                       The recurrence weight tensor with shape: [hidden_size,
                                hidden_size].
@param B:                       The sum of biases (weight and recurrence) with shape: [hidden_size].
@param hidden_size:             The number of hidden units for recurrent cell.
                                Specifies hidden state size.
@param activations:             The vector of activation functions used inside recurrent cell.
@param activation_alpha:        The vector of alpha parameters for activation functions in
                                order respective to activation list.
@param activation_beta:         The vector of beta parameters for activation functions in order
                                respective to activation list.
@param clip:                    The value defining clipping range [-clip, clip] on input of
                                activation functions.
@param name:                    Optional output node name.
@return   The new node performing a RNNCell operation on tensor from input node.

◆ roi_align()

Node ngraph.opset3.ops.roi_align ( NodeInput  data,
NodeInput  rois,
NodeInput  batch_indices,
int  pooled_h,
int  pooled_w,
int  sampling_ratio,
float  spatial_scale,
str  mode,
Optional[str]   name = None 
)

Return a node which performs ROIAlign.

@param data: Input data.
@param rois: RoIs (Regions of Interest) to pool over.
@param batch_indices: Tensor with each element denoting the index of
                      the corresponding image in the batch.
@param pooled_h: Height of the ROI output feature map.
@param pooled_w: Width of the ROI output feature map.
@param sampling_ratio: Number of bins over height and width to use to calculate
                       each output feature map element.
@param spatial_scale: Multiplicative spatial scale factor to translate ROI coordinates.
@param mode: Method to perform pooling to produce output feature map elements.

@return The new node which performs ROIAlign

◆ scatter_elements_update()

Node ngraph.opset3.ops.scatter_elements_update ( NodeInput  data,
NodeInput  indices,
NodeInput  updates,
NodeInput  axis,
Optional[str]   name = None 
)

Return a node which produces a ScatterElementsUpdate operation.

@param data:    The input tensor to be updated.
@param indices: The tensor with indexes which will be updated.
@param updates: The tensor with update values.
@param axis:    The axis for scatter.
@return ScatterElementsUpdate node

ScatterElementsUpdate creates a copy of the first input tensor with updated elements
specified with second and third input tensors.

For each entry in `updates`, the target index in `data` is obtained by combining
the corresponding entry in `indices` with the index of the entry itself: the
index-value for dimension equal to `axis` is obtained from the value of the
corresponding entry in `indices` and the index-value for dimension not equal
to `axis` is obtained from the index of the entry itself.

◆ scatter_update()

Node ngraph.opset3.ops.scatter_update ( Node  data,
NodeInput  indices,
NodeInput  updates,
NodeInput  axis,
Optional[str]   name = None 
)

Return a node which produces a ScatterUpdate operation.

ScatterUpdate sets new values to slices from data addressed by indices.

@param data:    The input tensor to be updated.
@param indices: The tensor with indexes which will be updated.
@param updates: The tensor with update values.
@param axis:    The axis at which elements will be updated.
@return ScatterUpdate node

◆ shape_of()

Node ngraph.opset3.ops.shape_of ( NodeInput  data,
str   output_type = "i64",
Optional[str]   name = None 
)

Return a node which produces a tensor containing the shape of its input data.

@param data: The tensor containing the input data.
@param output_type: Output element type.
@return ShapeOf node

◆ shuffle_channels()

Node ngraph.opset3.ops.shuffle_channels ( Node  data,
int  axis,
int  groups,
Optional[str]   name = None 
)

Perform permutation on data in the channel dimension of the input tensor.

@param data: The node with input tensor.
@param axis: Channel dimension index in the data tensor.
             A negative value means that the index should be calculated
             from the back of the input data shape.
@param group: The channel dimension specified by the axis parameter
             should be split into this number of groups.
@param name: Optional output node name.
@return The new node performing a permutation on data in the channel dimension
         of the input tensor.

The operation is the equivalent with the following transformation of the input tensor
`data` of shape [N, C, H, W]:

`data_reshaped` = reshape(`data`, [N, group, C / group, H * W])

`data_trnasposed` = transpose(`data_reshaped`, [0, 2, 1, 3])

`output` = reshape(`data_trnasposed`, [N, C, H, W])

For example:

@code{.py}
    Inputs: tensor of shape [1, 6, 2, 2]

            data = [[[[ 0.,  1.], [ 2.,  3.]],
                     [[ 4.,  5.], [ 6.,  7.]],
                     [[ 8.,  9.], [10., 11.]],
                     [[12., 13.], [14., 15.]],
                     [[16., 17.], [18., 19.]],
                     [[20., 21.], [22., 23.]]]]

            axis = 1
            groups = 3

    Output: tensor of shape [1, 6, 2, 2]

            output = [[[[ 0.,  1.], [ 2.,  3.]],
                       [[ 8.,  9.], [10., 11.]],
                       [[16., 17.], [18., 19.]],
                       [[ 4.,  5.], [ 6.,  7.]],
                       [[12., 13.], [14., 15.]],
                       [[20., 21.], [22., 23.]]]]
@endcode

◆ topk()

Node ngraph.opset3.ops.topk ( NodeInput  data,
NodeInput  k,
int  axis,
str  mode,
str  sort,
str   index_element_type = "i32",
Optional[str]   name = None 
)

Return a node which performs TopK.

@param data: Input data.
@param k: K.
@param axis: TopK Axis.
@param mode: Compute TopK largest ('max') or smallest ('min')
@param sort: Order of output elements (sort by: 'none', 'index' or 'value')
@param index_element_type: Type of output tensor with indices.
@return The new node which performs TopK (both indices and values)