albanD:

out = out.view(out.size(0), -1)


Ok, I have updated the block as below:
class CNN(torch.nn.Module):
    def __init__(self):
        super(CNN,self).__init__()
        self.conv1 = nn.Sequential(
            nn.Conv1d(708, 252, kernel_size=5, stride=1),  
            nn.Sigmoid(),
            nn.AvgPool1d(kernel_size=2, stride=2))
        self.conv2 = nn.Sequential(
            nn.Conv1d(252, 12, kernel_size=5, stride=1),
            nn.Sigmoid(),
            nn.AvgPool1d(kernel_size=2, stride=2))

        self.fc1 = nn.Linear(732, 708) 
        self.fc2 = nn.Linear(708, 4)

    def forward(self, x):
        out = self.conv1(x)
        out = self.conv2(out)
        out = out.view(out.size(0), -1)
        out = self.fc1(out)
        out = self.fc2(out)
        return out

Now I get this error for the loss function:
ValueError: Expected input batch_size (3) to match target batch_size (708).
These are the dimensions, how do I ensure y_hat is (708,4)
ytrain_shape: torch.Size([708, 4])
Y_hat shape: torch.Size([3, 4])