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 5 – Deeper Neural Networks : nn.ModuleList()

Viewing 0 reply threads
  • Author
    Posts
    • #1322
      Anonymous

      Consider the constructor for the following neural network class :
      class Net(nn.Module):
      # Section 1:
      def __init__(self, Layers):
      super(Net,self).__init__()
      self.hidden = nn.ModuleList()
      for input_size,output_size in zip(Layers,Layers[1:]):
      self.hidden.append(nn.Linear(input_size,output_size))
      Let us create an object model = Net([2,3,4,5])

      How many neurons are in the first hidden layers ?
      answer: 3

      True or False we use the following Class or . Module for classification :
      class Net(nn.Module):

      # Constructor
      def __init__(self, Layers):
      super(Net, self).__init__()
      self.hidden = nn.ModuleList()
      for input_size, output_size in zip(Layers, Layers[1:]):
      self.hidden.append(nn.Linear(input_size, output_size))

      # Prediction
      def forward(self, activation):
      L = len(self.hidden)
      for (l, linear_transform) in zip(range(L), self.hidden):
      if l < L – 1:
      activation = torch.relu(linear_transform(activation))
      else:
      activation = torch.relu(linear_transform(activation))
      return activation

      answer: False

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