Skip to content

Lab p02 6번에 관해서 질문있습니다

아래에 질문에있던 내용대로 ReLU함수를 변수로 선언해서 사용했습니다.

**

def __init__(self):
    """
    In the constructor we instantiate nn.Linear module
    """
    super(Model, self).__init__()
    self.linear = nn.Linear(1, 1)  # One in and one out

def forward(self, x):
    """
    In the forward function we accept a Variable of input data and we must return
    a Variable of output data.
    """
    R = nn.ReLU()
    y_pred = R(self.linear(x))
    return y_pred

**

Model 클래스의 코드를 이렇게 썼는데 결과가 all elements of input should be between 0 and 1가 나오면서 학습이 되지 않거나, 모든 epoch의 loss값이 50으로 고정되면서 이상한 결과가 나오게 됩니다. 혹시 추가적으로 바꿔줘야하는 패러미터나, 코드부분이 있을까요? 코드도 추가로 첨부합니다 Untitled3.ipynb

Edited by ahj6377