ngraph.unsqueeze(data: Union[_pyngraph.Node, int, float, numpy.ndarray], axes: Union[_pyngraph.Node, int, float, numpy.ndarray], name: Optional[str] = None) _pyngraph.Node

Perform unsqueeze operation on input tensor.

Insert single-dimensional entries to the shape of a tensor. Takes one required argument axes, a list of dimensions that will be inserted. Dimension indices in axes are as seen in the output tensor.

For example: Inputs: tensor with shape [3, 4, 5], axes=[0, 4]

Result: tensor with shape [1, 3, 4, 5, 1]

  • data – The node with data tensor.

  • axes – List of non-negative integers, indicate the dimensions to be inserted. One of: input node or array.


The new node performing an unsqueeze operation on input tensor.