namespace ngraph::builder::opset1¶
Overview¶
namespace opset1 {
// global functions
Output<Node> legacy_broadcast_for_binary_operation(
const Output<Node>& left,
const Output<Node>& right,
size_t start_match_axis
);
std::vector<std::size_t> get_axes_mapping(
const Shape& output_shape,
const AxisSet& broadcast_axes
);
Output<Node> get_axes_mapping_output(
const Shape& output_shape,
const Shape& input_shape,
std::size_t start_match_axis
);
Output<Node> get_axes_mapping_output(
const PartialShape& output_shape,
const PartialShape& input_shape,
std::size_t start_match_axis
);
Output<Node> get_axes_mapping_output(
const Shape& output_shape,
const AxisSet& broadcast_axes
);
Output<Node> make_broadcast(
const Output<Node>& node,
const Shape& target_shape,
const AxisSet& broadcast_axes
);
Output<Node> make_broadcast(
const Output<Node>& node,
const Shape& target_shape,
std::size_t start_match_axis
);
std::shared_ptr<Node> l0_norm(
const Output<Node>& value,
const Output<Node>& reduction_axes,
bool keep_dims = false
);
std::shared_ptr<Node> l1_norm(
const Output<Node>& value,
const Output<Node>& reduction_axes,
float bias = 0.f,
bool keep_dims = false
);
std::shared_ptr<Node> l2_norm(
const Output<Node>& value,
const Output<Node>& reduction_axes,
float bias = 0.f,
BiasMode bias_mode = BiasMode::ADD,
bool keep_dims = false
);
std::shared_ptr<Node> lp_norm(
const Output<Node>& value,
const Output<Node>& reduction_axes,
std::size_t p_norm = 2,
float bias = 0.f,
bool keep_dims = false
);
std::shared_ptr<Node> mean(
const Output<Node>& node,
const AxisSet& reduction_axes,
bool keep_dims = false
);
std::shared_ptr<Node> mean(
const Output<Node>& node,
const Output<Node>& reduction_axes,
bool keep_dims = false
);
std::shared_ptr<Node> variance(
const Output<Node>& value,
const AxisSet& reduction_axes,
const bool bessel_correction = false
);
std::shared_ptr<Node> variance(
const Output<Node>& value,
const Output<Node>& reduction_axes,
bool keep_dims = false,
bool bessel_correction = false
);
std::shared_ptr<Node> reshape(const Output<Node>& value, const Shape& shape);
std::shared_ptr<Node> reorder_axes(
const Output<Node>& value,
std::vector<size_t> axes_order = {}
);
std::shared_ptr<Node> transpose(const Output<Node>& value);
std::shared_ptr<Node> flatten(const Output<Node>& value, int axis);
std::shared_ptr<Node> expand_dims(
const Output<Node>& value,
std::size_t axis = 0
);
std::shared_ptr<Node> squeeze(
const Output<Node>& value,
std::vector<std::size_t> axes = {0}
);
std::shared_ptr<Node> collapse(
const Output<Node>& value,
const std::size_t start_axis,
const std::size_t end_axis
);
OutputVector split(
const Output<Node>& value,
const std::vector<int64_t>& split_lengths,
int64_t axis = 0
);
OutputVector split(
const Output<Node>& value,
int64_t num_splits,
int64_t axis = 0
);
} // namespace opset1
Detailed Documentation¶
Global Functions¶
Broadcast right node to left node’s shape using legacy scheme.
Parameters:
left |
The left hand side node of binary operation. |
right |
The right hand side node of binary operation. The one to be broadcasted. |
start_match_axis |
The axis index starting mutually equal shapes of both nodes. |
Returns:
The Output object connected to node producing broadcasted right node.
Reconstructs axes mapping vector for Broadcast:v1 operation.
Parameters:
output_shape |
The output shape of Broadcast operation. |
broadcast_axes |
The broadcast axes used for Broadcast:v0 operator. |
Returns:
The vector with axes indexes mapping .
Creates Node returning the axes mapping for Broadcast:v1 operation.
Parameters:
output_shape |
The output shape of Broadcast operation. |
input_shape |
The input shape. |
start_match_axis |
The axis index at which input shape starts to be identical as the output shape. |
Returns:
Returns the Output object pointing to node with the axes mapping.
Output<Node> get_axes_mapping_output(
const PartialShape& output_shape,
const PartialShape& input_shape,
std::size_t start_match_axis
)
Creates Node returning the axes mapping for Broadcast operation.
Shapes’ ranks need to be static.
Parameters:
output_shape |
The output shape of Broadcast operation. |
input_shape |
The input shape. |
start_match_axis |
The axis index at which input shape starts to be identical to consecutive subset of output shape dimensions. |
Returns:
Returns the Output object pointing to node with the axes mapping.
Creates Node returning the axes mapping for Broadcast:v1 operation.
Parameters:
output_shape |
The output shape of Broadcast operation. |
broadcast_axes |
The broadcast axes used for Broadcast:v0 operator. |
Returns:
The Output object with Node returning axes mapping.
Calculates L-0 norm of input tensor.
The L-0 norm represents the cardinality of elements different from zero. This actually is not a “true” norm.
Parameters:
value |
The input tensor. |
reduction_axes |
The axes along which we calculate norm. |
keep_dims |
The flag indicates if axes will be removed or kept. |
Returns:
L-0 norm of value. The output sub-graph is composed of v1 ops.
Calculates L-1 norm of a value.
The L-1 norm represents the sum of absolute values.
Parameters:
value |
The input tensor. |
reduction_axes |
The axes along which we calculate norm. |
bias |
The bias added to the calculated sum. |
keep_dims |
The flag indicates if axes will be removed or kept. |
Returns:
L-1 norm of value. The output sub-graph is composed of v1 ops.
Calculates L-2 norm of input tensor.
The L-2 norm represents the square root of sum of squares of each individual element.
Parameters:
value |
The input tensor. |
reduction_axes |
The axes along which we calculate norm. |
bias |
The bias combined with calculated sum. |
bias_mode |
The method of bias application. |
keep_dims |
The flag indicates if axes will be removed or kept. |
Returns:
L-2 norm of value. The output sub-graph is composed of v1 ops.
Creates node which calculates L-p norm on input tensor.
Parameters:
value |
The input tensor. |
reduction_axes |
The axes along which we calculate norm. |
p_norm |
The p norm to calculate. |
bias |
The bias added to the calculated sum. |
keep_dims |
The flag indicates if axes will be removed or kept. |
Returns:
L-p norm of value. The output sub-graph is composed of v1 ops.
Sum-based Mean of a Tensor.
Calculates
\(\sum_{i=1}^{N} \frac{x_i}{N}\)
Where i
traverses all of the axes provided in reduction_axes
Inputs¶
node
| \(E[d_1,\dots,d_n]~(n \geq 0)\) | An input tensor of any shape | | reduction_axes
| AxesSet | The axes to eliminate through reduction (0 indexed). | | keep_dims
| bool | If set to true it holds reduced axes. |Output¶
Type |
Description |
---|---|
\(E[\textit{delete}(A,d_1,\dots,d_n)]\) |
The tensor \(T\) , where \(T\) is the input tensor with the |
Sum-based Variance of a Tensor.
If bessel_correct is true, calculates
\(\frac{\sum_{i=1}^{N}\left(x_i-\bar{x}\right)^2}{N-1}\)
else, calculates
\(\frac{\sum_{i=1}^{N}\left(x_i-\bar{x}\right)^2}{N}\)
Where i
traverses all of the axes provided in reduction_axes
and \(\bar{x} = \sum_{i=1}^{N} \frac{x_i}{N}\)
Inputs¶
Type |
Description |
|
---|---|---|
|
bool (default = false) |
Enable Bessel’s correction to std_dev for Small sample sizes |
Output¶
Type |
Description |
---|---|
\(E[\textit{delete}(A,d_1,\dots,d_n)]\) |
The tensor \(T\) , where \(T\) is the input tensor with the |
Change shape of a value.
Parameters:
value |
The value to be reshaped. |
shape |
The new shape. |
Returns:
Reshape:v1 op.
Permute axes according to specified axes_order parameter.
Parameters:
The |
vlaue whose axes we want to permute. |
axes_order |
The permutation of axes. |
Returns:
Transpose:v1 op.
Return transposed value (with axes in reversed order).
Parameters:
Value |
to transpose. |
Returns:
Transpose:v1 op.
Flatten a value into a 2D matrix, with a static dividing axis.
Parameters:
The |
tensor to be flattened. |
The |
axis dividing shape. |
Returns:
The new value will be a 2D matrix representing the flattened input node.
Expands node tensor shape with empty axis at specified position.
Parameters:
value |
The value to be expanded. |
axis |
The position in the expanded axes where the new axis is placed. |
Returns:
Reshape:v1 op.
Remove empty axes from input tensor.
Parameters:
value |
The value to be squeezed. |
axes |
The vector defining indexes of axes to be removed. |
Returns:
Reshape:v1 op.
Collapse specified axes into single one.
Collapsed axes create a continuous range starting from outermost axis.
Parameters:
value |
The value to be reshaped. |
start_axis |
The start axis index. |
end_axis |
The end axis (inclusive) index. |
Returns:
The node with collapsed specified axes.
OutputVector split(
const Output<Node>& value,
const std::vector<int64_t>& split_lengths,
int64_t axis = 0
)
Split value on specified axis into multiple parts.
This implementation supports negative axis
values (similar to NumPy indexing). This means that the axis to split on will be counted from the back of the tensor (negative values are subtracted from its rank).
Parameters:
value |
The value to be split. |
split_lengths |
The vector defining the lengths of each split part. |
axis |
The axis we split input node on. Default value is zero axis. |
Returns:
The vector containing multiple outputs we split input node into. The vector is output of Split:v1 op
OutputVector split(
const Output<Node>& value,
int64_t num_splits,
int64_t axis = 0
)
Split value on specified axis into multiple parts.
This implementation supports negative axis
values (similar to NumPy indexing). This means that the axis to split on will be counted from the back of the tensor (negative values are subtracted from its rank).
Parameters:
value |
The value to split. |
num_splits |
The number of parts we want to split output at given axis. The length of the axis to split must be divisible by this value. |
axis |
The axis we split input node on. Default value is zero axis. |
Returns:
The vector containing multiple nodes we split input node into. The vector is output of VariadicSplit:v1 op