U
    Mh                     @   s(   d Z ddlZddlZdd Zdd ZdS )an  This file provides a location for operators that help exporting models via onnx.

E.g. `shape_as_tensor` and `reshape_from_tensor_shape`
are to make all dynamic sizes operations traceable.

NOTE: at one point these functions were implemented differently.
Since then we have implemented these directly in ATen, so this
file is kept purely for backward-compatibility.
    Nc                 C   s
   t | S )a.  Get the shape of a tensor as a tensor.

    Args:
        x (Tensor): The input tensor.

    Returns:
        Tensor: A tensor of shape [len(x.shape)] containing the size of each dimension of x.

    Example:
        >>> x = torch.randn(2, 3)
        >>> shape_as_tensor(x)
        tensor([2, 3])

    )torchZ_shape_as_tensor)x r   F/var/www/html/venv/lib/python3.8/site-packages/torch/onnx/operators.pyshape_as_tensor   s    r   c                 C   s   t | |S )N)r   Z_reshape_from_tensor)r   shaper   r   r   reshape_from_tensor_shape"   s    r   )__doc__r   Z
torch.onnxr   r   r   r   r   r   <module>   s   
