Example 2 : Varying the depth of a layer