Any Pytorch model is instantiated like a Python object. Unlike TensorFlow, there is no strict notion of a session object inside which the code is compiled and then run. The model class is as we have written previously.
The init function of the preceding class accepts a few parameters:
- hidden_dim: These are hidden layer dimensions, that is, the vector length of the hidden layers
- emb_dim=300: This is an embedding dimension, that is, the vector length of the first input step to the LSTM
- num_linear=2: The other two dropout parameters:
- spatial_dropout=0.05
- recurrent_dropout=0.1
Both dropout parameters act as regularizers. They help prevent the model from overfitting, that is, the state where the model ends up learning ...