Question about the W4A2: values of a_G and a_S in compute_layer_style_cost

Can someone answer a few questions:
in the function compute_layer_style_cost,

  1. where are the values a_G and a_S being sent from? The calling routine doesn’t seem to pass these parameters:
    compute_layer_style_cost_test(compute_layer_style_cost)

  2. Where is the compute_layer_style_cost_test function defined?

  3. when I print the values of a_S and a_G as first statements inside the compute_layer_style_cost function, i am getting the same values for both a_G and a_S. Why is that so?

    print(‘a_S’ ,a_S)
    print(‘a_G’, a_G)

a_S tf.Tensor(
[[[[ 2.6123514 -3.3520837 0.74761856]
[ 6.3462267 3.8470404 -0.95714605]
[-2.0568852 -3.1489944 -4.0077353 ]
[ 1.0848972 -1.2055032 -5.972679 ]]

[[-0.34144378 -3.17067 5.036553 ]
[ 5.9450154 -1.7347562 3.6944358 ]
[-0.68249106 -3.1652112 -1.7189786 ]
[ 6.6380787 -0.90944517 9.18924 ]]

[[ 4.405425 0.31713337 2.566379 ]
[ 3.2136106 0.23800504 1.4399388 ]
[-0.88850987 -0.10706711 -1.7099016 ]
[ 8.216282 0.6901974 3.6196625 ]]

[[ 1.1940846 1.7071393 -0.9568796 ]
[-3.8442307 6.2297974 2.8206615 ]
[ 4.486284 -2.2124014 -4.4811783 ]
[-3.2315984 -5.5964684 3.4338741 ]]]], shape=(1, 4, 4, 3), dtype=float32)
a_G tf.Tensor(
[[[[ 2.6123514 -3.3520837 0.74761856]
[ 6.3462267 3.8470404 -0.95714605]
[-2.0568852 -3.1489944 -4.0077353 ]
[ 1.0848972 -1.2055032 -5.972679 ]]

[[-0.34144378 -3.17067 5.036553 ]
[ 5.9450154 -1.7347562 3.6944358 ]
[-0.68249106 -3.1652112 -1.7189786 ]
[ 6.6380787 -0.90944517 9.18924 ]]

[[ 4.405425 0.31713337 2.566379 ]
[ 3.2136106 0.23800504 1.4399388 ]
[-0.88850987 -0.10706711 -1.7099016 ]
[ 8.216282 0.6901974 3.6196625 ]]

[[ 1.1940846 1.7071393 -0.9568796 ]
[-3.8442307 6.2297974 2.8206615 ]
[ 4.486284 -2.2124014 -4.4811783 ]
[-3.2315984 -5.5964684 3.4338741 ]]]], shape=(1, 4, 4, 3), dtype=float32)

compute_layer_style_cost_test is defined inside public_tests.py which is located in the same folder as your notebook. Please familiarize yourself with the jupyter interface to open the file using the explorer or the file menu.

Python supports passing functions by reference. The caller can make use of the function like this:

def add(a, b):
    return a + b

def add_test(add_fn):
    assert add_fn(2, 3) == 5

add_test(add)

Thanks Balaji for the explanation. However, I dont understand why the a_S and a_G are the same arrays (see above).

Can someone explain that? Thanks,

i see that the compute layer style cost is called with a_G, a_G parameters first and hence they are same.