直接上代码
import torch
import matplotlib.pyplot as plt
A = torch.arange(-10, 10, 1, dtype=torch.float(32))
def relu(x):
return torch.maximum(torch.tensor(0), x)
plt.plot(relu(A))
结果如下:

import torch
import matplotlib.pyplot as plt
A = torch.arange(-10, 10, 1, dtype=torch.float(32))
def sigmoid(x):
return 1 / (1 + torch.exp(-x))
plt.plot(sigmoid(A))












![[Rust开发]用可视化案例讲Rust编程6.动态分发与最终封装](https://img-blog.csdnimg.cn/img_convert/564b4d0f70112b21bb0542c8f930b065.png)





