Pytorch_sentdex Flashcards
what is F and nn. Is there a relation between them
Yes, F is function and nn is more of Oops way. Pytorch has this difference due to architectural differences
what is the 1st and 2nd step in building the neural network
1st step is to define the structure of NN and next step is to define how the data is passed through the Network
what do you understand by flatten
Flattened is that all the data in the 28*28 form is converted into one continuous row
Basic code to form and check the layers
Roam -> Pytorch, #nn_layer_initialization
why wont this work #nn_data_pass
Because activation function is not defined
Name some standard optimizers and does the last layer needs activation function if no y if yes y
ReLu, LeakyRelu, Sigmoid, Tanh. Yes
For a probability distribution output, what is the best loss function? What is the dimension that is needed
Log_soft_max always work with multiclass classifier. Dim=1 You can further note that dim = 0.
Remember how to define the optimizer, loss
nn_init_forward_optim_loss. Can the loss be defined
How can you send a random training data into a nn and how your dimension of input data should look.
X.view(-1,28*28).
How to build a network where the 1st few layers are general layers and the rest of the later layers are specific layers
nn_logics_forward_cool.
If your output is numbers can you use MSE ?
No better use nll_loss. MSE can be used only for one hot encoded output value [0,0,0,1,0,0,0,0,0,0 ]
Why do we need to call zero_grad() in PyTorch?
In PyTorch, we need to set the gradients to zero before starting to do backpropragation because PyTorch accumulates the gradients on subsequent backward passes. This is convenient while training RNNs. So, the default action is to accumulate (i.e. sum) the gradients on every loss.backward() call.
TORCH.ARGMAX
Returns the indices of the maximum value of all elements in the input tensor.
COde to write one hot vector for multiclass classification
np.eye
vol = torch.unsqueeze(vol, 0) # Whats teh meaning of 0
0 represents the lockation at which the new dimension should be added
How to convert an array into tensor float in one line
vol = torch.from_numpy(vol_arr).float()
How to plot an image data which is in an array form
import matplotlib.pyplot as plt
plt.imshow()
We should be aware of three different kinds of numerical values
continuous values (strictly ordered, and a difference between various values has a strict meaning) Further ratio scale and interval scale Ordinal Value (small medium large) categorical values
Can you tell the order of the neural network
Epoch Forward Pass Loss Backward pass Update Params
*params
model(t_un, *params) what is this equivalent to
to pass the elements of params as individual arguments
model(t_un, params[0], params[1])
what comes under functional API
whatever doesnot have parameters and need not be defined in init function, which doesnot have parametes that require a gradient to carry. These things can be associated to funtional API
through locality and translation invariance
locality
Translation invariace - neifhours