Hello Team,
I have the same problem in the implementation of the AutoEncoder
this is the class AE:
import torch.nn as nn
import torch
class AE(nn.Module):
def init(self):
super(AE,self).init()
input_shape=256
self.encoder_hidden_layer=nn.Linear(input_shape,10)
self.encoder_output_layer=nn.Linear(10,2)
self.decoder_hidden_layer=nn.Linear(2,10)
self.decoder_output_layer=nn.Linear(10,input_shape)
self.encoder_hidden_layer1 = nn.Linear(input_shape, 10)
self.encoder_output_layer1= nn.Linear(10, 2)
self.decoder_hidden_layer1 = nn.Linear(2, 10)
self.decoder_output_layer1= nn.Linear(10, input_shape)
def forward(self,features):
activation=self.encoder_hidden_layer(features)
activation=torch.relu(activation)
code=self.encoder_output_layer(activation)
code = torch.relu(code)
activation=self.decoder_hidden_layer(code)
activation=torch.relu(activation)
activation=self.decoder_output_layer(activation)
reconstructed=torch.sigmoid(activation)
    activation1 = self.encoder_hidden_layer1(reconstructed)
    activation = torch.relu(activation1)
    code = self.encoder_output_layer1(activation)
    code = torch.relu(code)
    activation = self.decoder_hidden_layer1(code)
    activation = torch.relu(activation)
    activation = self.decoder_output_layer1(activation)
    reconstructed = torch.sigmoid(activation)
    return reconstructed

when i train the model, the error in the first line of forward function
please how i can solve the problem?