Problem 10.
Build a ReLU module that subclasses torch.nn.Module and is named My_ReLU.
1 Like
import torch
import torch.nn as nn
class My_ReLU(nn.Module):
def __init__(self):
super(My_ReLU, self).__init__()
pass
def forward(self, input: torch.Tensor) -> torch.Tensor:
return torch.relu(input)
1 Like