1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Deep Learning with PyTorch

Connected

Exercise

The sigmoid and softmax functions

The sigmoid and softmax functions are key activation functions in deep learning, often used as the final step in a neural network.

  • Sigmoid is for binary classification
  • Softmax is for multi-class classification

Given a pre-activation output tensor from a network, apply the appropriate activation function to obtain the final output.

torch.nn has already been imported as nn.

Instructions 1/2

undefined XP
  • 1
    • Create a sigmoid function and apply it on input_tensor to generate a probability for a binary classification task.
  • 2
    • Create a softmax function and apply it on input_tensor to generate a probability for a multi-class classification task.