FilesLast commitLast update
20 days ago
20 days ago
15 days ago
20 days ago
10 months ago
20 days ago
6 days ago
README

SqueezeV3

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

API function: removes dimensions whose size is 1 from a tensor. axes is provided as an optional input. Example:

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

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

If axes 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
axes Optional input
  • List of dimensions to be removed. The value ranges from [-rank(x), rank(x))
  • 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
INT64 ND
y Output Squeezed output tensor, whose data type is the same as that of the input x All types ND

Constraint Description

  • If axes is specified, the size of the dimension corresponding to axes must be 1 or -1. Otherwise, the operator fails to execute.
  • If the value of axes is out of the range [-rank(x), rank(x)), the operator fails to execute.
  • If the input has a dynamic shape (containing -1) and axes 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.
  • If the input shape is determined but axes cannot be obtained at the compilation stage (for example, axes comes from an upstream computation result), the output shape is set to -2.

Invocation Description

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