This error occurs when trying to use the 'leaky_relu' function of the PyTorch library but the function is not found in the 'torch' module. This can happen if the PyTorch version being used is outdated and does not have the 'leaky_relu' function.

To fix this error, try updating the PyTorch version to the latest version using the following command:

pip install torch --upgrade

If the issue still persists, try importing the 'leaky_relu' function from the 'torch.nn.functional' module instead of using it directly from the 'torch' module:

import torch.nn.functional as F

output = F.leaky_relu(input, negative_slope=0.01)

原文地址: https://www.cveoy.top/t/topic/muXB 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录