FilesLast commitLast update
15 days ago
15 days ago
15 days ago
15 days ago
15 days ago
15 days ago
5 days ago
README

SqueezeV2

English | 简体中文

Product Support Status

Product Supported
Ascend 950PR&950DT products √
Atlas A3 products √
Atlas A2 products √
Atlas 200I/500 A2 inference products √
Atlas inference products √
Atlas training products √

Function Description

Operator function: removes dimensions whose size is 1 from a tensor. axis is provided as an attribute. This operator is a deprecated version, and it is recommended that you use the Squeeze operator first. Example:

If axis is empty, all dimensions whose size is 1 are removed:

>>> x = torch.randn(2, 1, 3)
>>> torch.squeeze(x).shape
(2, 3)

If axis is specified, only the specified dimensions whose size is 1 are removed:

>>> x = torch.randn(2, 1, 3)
>>> torch.squeeze(x, 1).shape
(2, 3)

Parameter Description

Parameter Name Input/Output/Attribute Description Data Type Data Format
x Input Input tensor to be squeezed All types ND
axis Attribute
  • List of dimensions to be removed. The value ranges from [-rank(x), rank(x)), and negative indices are supported
  • If it is not specified or is empty, all dimensions whose size is 1 are removed
  • If it is specified, only the specified dimensions are removed, and the size of each specified dimension must be 1
ListInt, and the default value is [] -
y Output Squeezed output tensor, whose data type is the same as that of the input x All types ND

Constraint Description

  • If axis is specified, the size of the dimension corresponding to axis must be 1 or -1. Otherwise, the operator fails to execute.
  • If the value of axis is out of the range [-rank(x), rank(x)), or the number of axes after deduplication based on the original values is greater than or equal to the number of input dimensions, the output shape falls back to the input shape (squeeze is not executed).
  • If the input has a dynamic shape (containing -1) and axis is empty, whether the -1 dimension is 1 cannot be determined, and the output shape is set to -2.
  • If the input shape is -2, the output shape is -2.

Invocation Description

Invocation Method Sample Code Description
Graph-mode invocation test_geir_squeezev2 Invokes the SqueezeV2 operator by building a graph through the operator IR.