---
title: sqrt
description: "计算每个元素（非负）的平方根，即。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_1089.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_1089.html
indexId: bdb1bf308d53195f17cdbe701e4f224d332d1184549476da66958bf11939d42d61
---
# sqrt

#### 功能描述

计算每个元素（非负）的平方根，即。


#### 必选输入参数

| 参数名 | 类型 | 说明 |
| --- | --- | --- |
| x | array\_like | 输入的数组或标量。 |


#### 可选输入参数

| 参数名 | 类型 | 默认值 | 说明 |
| --- | --- | --- | --- |
| out | ndarray或ndarray的元组 | None | 计算结果保存的位置。如果提供，其形状必须与输入数组广播后的形状一致。未指定时，返回一个新的数组。 |
| where | array\_like | None | 将被广播至输入的条件数组。在条件为真处的元素，其计算结果会存入out中，其余位置保留原有值。 |
| \*\*kwargs | \- | \- | 其他关键字参数，请参见NumPy官方文档Universal functions (ufunc)(https://numpy.org/doc/stable/reference/ufuncs.html\#ufuncs\-kwargs)。 |


#### 返回数据

| 类型 | 说明 |
| --- | --- |
| ndarray/scalar | 每个元素（非负）的平方根的结果。 |


#### 示例

```
>>> import numpy as np
>>> np.sqrt(4)
2.0
>>>
>>> x = np.array([2.25, 6.25, 25])
>>> np.sqrt(x)
array([1.5, 2.5, 5. ])
>>>
```
