Step by step intro
Do you like pytorch?
Convert input to tensor
if not torch.is_tensor(input):
self.input = torch.from_numpy(input)Convert to tf:
change if data type matches! numpy tensor etc
tf.cast(x, dtype)Initialize parameters
np.random.randn
np.random.seed(3)
W1 = np.random.randn(n_h, n_x) * 0.01
b1 = np.zeros(shape = (n_h, 1))
W2 = np.random.randn(n_y, n_h) * 0.01
b2 = np.zeros(shape = (n_y, 1))Choose an optimization algorithm
Build a model
1. Forward propagate an input
torch.nn.Module.forward
2. Compute the loss function
nn.CrossEntropyLoss
Link to other loss functions
3. Compute the gradients of the cost with respect to parameters using backpropagation
4. Update each parameter using the gradients, according to the optimization algorithm
Fine-tuning
Wk4 - Building your Deep Neural Network: Step by StepLast updated
Was this helpful?