Torch.tanh() vs nn.Tanh()

That can be very confusing btw, please mention in description, that another hyperbolic tangent exists in torch, and students should use nn.Tanh().

Here are the first two lines of the “import” cell early in the notebook:

import torch
from torch import nn

The nn module there is the Torch Neural Networks module. It was introduced in the first Intro to PyTorch assignment in Week 1. All the neural network layer functions that we are using here are from torch.nn.