Phone

+919997782184

Email

support@roboticswithpython.com

Geeks of Coding

Join us on Telegram

Home Forums Assignment courserra IBM AI Engineering Professional Certificate Deep Neural Networks with PyTorch WEEK 2 – Prediction in One Dimension – QUIZ

Viewing 0 reply threads
  • Author
    Posts
    • #1194
      Yash AroraYash Arora
      Keymaster

      Question 1 –
      What’s wrong with the following class or custom module:

      # Customize Linear Regression Class
      
      class LR(nn.Module):
          
          # Constructor
          def __init__(self, input_size, output_size):
              
              # Inherit from parent
              super(LR, self).__init__()
              linear = nn.Linear(input_size, output_size)
          
          # Prediction function
          def forward(self, x):
              out = self.linear(x)
              return out

      Answer :
      “linear” should be self.linear

      Question 2 –
      what is wrong with the following lines of code:

      class LR(nn.Module):
          
          # Constructor
          def __init__(self, input_size, output_size):
              
              # Inherit from parent
              super(dog, self).__init__()
              self.linear = nn.Linear(input_size, output_size)
          
          # Prediction function
          def forward(self, x):
              out = self.linear(x)
              return out

      Answer:
      super(dog, self) should be super(LR, self)

Viewing 0 reply threads
  • You must be logged in to reply to this topic.