title: How to implement Softmax regression with pytorch?
body: <p>I am working on a uni assignment where I need to implement <code>Softmax Regression</code> with <code>Pytorch</code>. The assignment says:</p>
  <pre><code>Implement Softmax Regression as an nn.Module and pipe its output with its output with torch.nn.Softmax.
  </code></pre>
  <p>As I am new to pytorch, I am not sure how to do it exactly. So far I have tried:</p>
  <p>class SoftmaxRegression(nn.Module):  # inheriting from nn.Module!</p>
  <pre><code>def __init__(self, num_labels, num_features):
  
      super(SoftmaxRegression, self).__init__()
      self.linear = torch.nn.Linear(num_labels, num_features)
  
  def forward(self, x):
      # should return the probabilities for the classes, e.g.
      # tensor([[ 0.1757,  0.3948,  0.4295],
      #         [ 0.0777,  0.3502,  0.5721], 
      #         ...
  
      # not sure what to do here
  </code></pre>
  <p>does anybody have any idea how I could go about it? I am not sure what should be written in the <code>forward</code> method. I appreciate any help !</p>