SyntaxError: invalid syntax

Manik_Hossain: <pre data-code-wrap="python"><code class="lang-python">class net(nn.Module):
  def __init__(self):
    super().__init__()
    self.l1=nn.Linear(200,200)
    self.b1=nn.BatchNorm1d(200)
    self.d1=nn.Dropout(p=.3)
    self.l2=nn.Linear(200,200)
    self.b2=nn.BatchNorm1d(200)
    self.d2=nn.Dropout(p=.3)
    
    self.l3=nn.Linear(200,100)
    self.b3=nn.BatchNorm1d(100)
    self.d3=nn.Dropout(p=.3)
    self.l4=nn.Linear(100,100)
    self.b4=nn.BatchNorm1d(100)
    self.d4=nn.Dropout(p=.3)
    
    self.l5=nn.Linear(100,50)
    self.b5=nn.BatchNorm1d(50)
    self.d5=nn.Dropout(p=.3)
    self.l6=nn.Linear(50,50)
    self.b6=nn.BatchNorm1d(50)
    self.d6=nn.Dropout(p=.3)
    
    self.l7=nn.Linear(50,10)
    
  def forward(self,x):
    x200=self.d2(self.b2(F.relu(self.l2(self.d1(self.b1(F.relu(self.l1(x)))))))+x
    
    x100=F.relu(self.l3(x200))
    
    x100x=self.b4(self.d4(F.relu(self.l4(self.b3(self.d3(x100)))))+x100
    
    x50=F.relu(self.l5(x100x))
    
    x50_=self.b6(self.d6(F.relu(self.l5(self.b5(self.d5(x50)))))+x50
    
    x10=F.relu(self.l7(x50_))
    
    return x10
</code></pre>
<pre data-code-wrap="python"><code class="lang-python">File "&lt;ipython-input-14-8f4102c2f059&gt;", line 30
    x100=F.relu(self.l3(x200))
       ^
SyntaxError: invalid syntax
</code></pre>
<p>how to fix it?<strong>strong text</strong><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/2X/b/b8b333c60925acd0f46d3f775efe2e9e851525c9.png" data-download-href="https://discuss.pytorch.org/uploads/default/b8b333c60925acd0f46d3f775efe2e9e851525c9" title="pytorch%20invalid"><img src="https://discuss.pytorch.org/uploads/default/original/2X/b/b8b333c60925acd0f46d3f775efe2e9e851525c9.png" alt="pytorch%20invalid" data-base62-sha1="qlVNczfXiz2ToUzNgjPvgDaaDSF" width="458" height="500" data-dominant-color="EFF0F1"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">pytorch%20invalid</span><span class="informations">788×859 37.7 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

ptrblck: <p>Some closing parentheses are missing.<br>
Also, you are reusing <code>self.l5</code>, which should probably be <code>self.l6</code> for the calculation of <code>x50_</code>.<br>
This code should work:</p>
<pre><code class="lang-python">  def forward(self,x):
    x200=self.d2(self.b2(F.relu(self.l2(self.d1(self.b1(F.relu(self.l1(x))))))))+x
    
    x100=F.relu(self.l3(x200))
    
    x100x=self.b4(self.d4(F.relu(self.l4(self.b3(self.d3(x100))))))+x100
    
    x50=F.relu(self.l5(x100x))
    
    x50_=self.b6(self.d6(F.relu(self.l6(self.b5(self.d5(x50))))))+x50
    
    x10=F.relu(self.l7(x50_))
    
    return x10
</code></pre>
<p>PS: I’ve formatted your code so that I could easily copy it. You can add code snippets using three backticks ``` <img src="https://discuss.pytorch.org/images/emoji/apple/wink.png?v=6" title=":wink:" class="emoji" alt=":wink:"></p>

Manik_Hossain: <p>you are awosome… thanks</p>

AYYAPPAN_T_20BAI1305: <p>Class NN:<br>
def__intit__(self,numIn,numOut,setWeights):<br>
self.inp = [N(‘inp’) for i in range(numIn)]<br>
self.out = [N(‘out’) for i on range(numOut)]<br>
self.hid = [N(‘hid’), N(‘hid’),N(‘hid’) ]<br>
self.setWeights = setWeights<br>
self.score = 0<br>
self.fitness = 0.0</p>
<pre><code>def rollWeights(self):
    nodes = []
    for n in self.inp:
        nodes.append(n)
    for n in self.hid:
        nodes.append(n)
    for n in seld.out:
        nodes.append(n)
    weightList =[]
    for n in nodes:
        for w in n.weights:
            weightList.append(w)
    return  weightList

def unrollWeights(self,node,weightList):
    for c in node.connectBack:
        node.weights,append(weightsList[0])
        weightList.pop(0)

Class NN:
      ^
</code></pre>
<p>SyntaxError: invalid syntax</p>

ptrblck: <p><code>Class NN:</code> is invalid as the <code>class</code> type uses lowercase letters.</p>