torch.sq
时间: 2023-07-03 10:04:27 浏览: 147
0463-极智开发-解读torch.cat的用法
5星 · 资源好评率100%
I believe you meant to type "torch.sqrt".
"torch.sqrt" is a function in the PyTorch library that computes the square root of the input tensor element-wise. It takes a tensor as input and returns a new tensor with the same shape as the input tensor, where each element is the square root of the corresponding element in the input tensor.
Here's an example:
```python
import torch
x = torch.tensor([4.0, 9.0, 16.0])
y = torch.sqrt(x)
print(y) # Output: tensor([2., 3., 4.])
```
阅读全文