.. _op_ai_onnx_Sqrt: Sqrt ==== - **Domain**: ``ai.onnx`` - **Since version**: 13 Square root takes one input data (Tensor ) and produces one output data (Tensor ) where the square root is, y = x^0.5, is applied to the tensor elementwise. If x is negative, then it will return NaN. **Inputs** - **X** (*T*): Input tensor **Outputs** - **Y** (*T*): Output tensor **Type Constraints** - **T**: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16). Examples -------- **test_cc_sqrt** .. code-block:: text Node: Sqrt(x) -> (y) .. code-block:: text Inputs: x: shape=(2, 3), dtype=float32 [[0. , 0.25, 1. ], [2. , 4. , 9. ]] Outputs: y: shape=(2, 3), dtype=float32 [[0. , 0.5 , 1. ], [1.4142135, 2. , 3. ]] **test_cc_sqrt_bfloat16** .. code-block:: text Node: Sqrt(x) -> (y) .. code-block:: text Inputs: x: shape=(2, 3), dtype=bfloat16 [[0, 0.25, 1], [2.25, 4, 9]] Outputs: y: shape=(2, 3), dtype=bfloat16 [[0, 0.5, 1], [1.5, 2, 3]] **test_cc_sqrt_float16** .. code-block:: text Node: Sqrt(x) -> (y) .. code-block:: text Inputs: x: shape=(2, 3), dtype=float16 [[0. , 0.25, 1. ], [2.25, 4. , 9. ]] Outputs: y: shape=(2, 3), dtype=float16 [[0. , 0.5, 1. ], [1.5, 2. , 3. ]] **test_sqrt** .. code-block:: text Node: Sqrt(x) -> (y) .. code-block:: text Inputs: x: shape=(3, 4, 5), dtype=float32 [[[0.5665616 , 0.7457818 , 0.97100276, 0.4443592 , 0.4442647 ], [0.7628944 , 0.87734866, 0.5230672 , 0.2855087 , 0.79399663], [0.40414217, 0.60542035, 0.4549379 , 0.530079 , 0.4359654 ], [0.16703498, 0.64533466, 0.8153506 , 0.681705 , 0.88432455]], [[0.06596019, 0.08141465, 0.49587995, 0.12310889, 0.28691137], [0.04790118, 0.5155199 , 0.7137708 , 0.04374827, 0.9977479 ], [0.5978522 , 0.5865951 , 0.39716926, 0.43898672, 0.25327316], [0.5297574 , 0.5436708 , 0.74823534, 0.8180335 , 0.66857344]], [[0.86182827, 0.70817924, 0.23636054, 0.6562355 , 0.86890894], [0.8393313 , 0.32443324, 0.15917933, 0.893939 , 0.91269016], [0.30185628, 0.13158494, 0.32568365, 0.9401739 , 0.39366215], [0.08773083, 0.60704976, 0.1554775 , 0.9583321 , 0.8756153 ]]] Outputs: y: shape=(3, 4, 5), dtype=float32 [[[0.75270283, 0.8635866 , 0.9853947 , 0.66660273, 0.66653186], [0.87343824, 0.93666893, 0.7232338 , 0.5343301 , 0.8910649 ], [0.63572174, 0.7780876 , 0.67449087, 0.72806525, 0.6602768 ], [0.40869913, 0.80332726, 0.90296763, 0.82565427, 0.94038534]], [[0.25682718, 0.28533253, 0.70418745, 0.35086876, 0.5356411 ], [0.21886338, 0.71799713, 0.8448496 , 0.20916088, 0.9988733 ], [0.77320904, 0.76589495, 0.6302137 , 0.6625607 , 0.5032625 ], [0.72784436, 0.73734033, 0.86500597, 0.904452 , 0.81766343]], [[0.92834705, 0.84153384, 0.48616925, 0.8100836 , 0.93215287], [0.9161503 , 0.5695904 , 0.39897284, 0.9454835 , 0.9553482 ], [0.5494145 , 0.3627464 , 0.570687 , 0.96962565, 0.627425 ], [0.2961939 , 0.779134 , 0.39430633, 0.9789444 , 0.93574315]]] **test_sqrt_example** .. code-block:: text Node: Sqrt(x) -> (y) .. code-block:: text Inputs: x: shape=(3,), dtype=float32 [1., 4., 9.] Outputs: y: shape=(3,), dtype=float32 [1., 2., 3.] Differences with previous version (6) ------------------------------------- **SchemaDiff**: ``Sqrt`` (domain ``'ai.onnx'``) * old version: 6 * new version: 13 * breaking: no **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] Version History --------------- - :doc:`Version 6 ` - :doc:`Version 1 `