1 of 30

Backpropagation (cont.)�

Prof. André E. Lazzaretti

lazzaretti@utfpr.edu.br

2 of 30

Gradients

  • Backpropagation intuition
  • Toy model
  • Background mathematics
  • Backpropagation forward pass
  • Backpropagation backward pass

​

​

3 of 30

Matrix calculus

Scalar function f[] of a vector a

4 of 30

Matrix calculus

Scalar function f[] of a matrix A

5 of 30

Matrix calculus

Vector function f[] of vector a

6 of 30

Comparing vector and matrix

Scalar derivatives:

Matrix derivatives:

7 of 30

Comparing vector and matrix

Scalar derivatives:

Matrix derivatives:

8 of 30

Gradients

  • Backpropagation intuition
  • Toy model
  • Background mathematics
  • Backpropagation forward pass
  • Backpropagation backward pass

​

​

​

9 of 30

The forward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

10 of 30

Gradients

  • Backpropagation intuition
  • Toy model
  • Background mathematics
  • Backpropagation forward pass
  • Backpropagation backward pass

​

​

​

11 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

12 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

13 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

14 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

15 of 30

Derivative of ReLU

“Indicator function”

16 of 30

Derivative of RELU

1. Consider:

where:

2. We could equivalently write:

3. Taking the derivative

4. We can equivalently pointwise multiply by diagonal

17 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

18 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

4. Take derivatives w.r.t.

parameters

​

​

19 of 30

The backward pass

1. Write this as a series of

intermediate calculations

​

2. Compute these intermediate quantities

​

3. Take derivatives of output with respect to intermediate quantities

​

4. Take derivatives w.r.t.

parameters

​

​

20 of 30

Backprop summary

21 of 30

Backprop summary

22 of 30

23 of 30

24 of 30

25 of 30

26 of 30

27 of 30

28 of 30

29 of 30

30 of 30