OK, let’s take a look at the test block.
Firstly the conv2D function that I am calling is written inside a function
def identity_block(X, f, filters, training=True, initializer=random_uniform)
This function doesn’t seem to take the form of the filters, just the number of filters (as a numpy array) in different layers.
In the test block the function above is called as
identity_block(X, f=2, filters=[4, 4, 3],
initializer=lambda seed=0:constant(value=1),
training=False)
here you can see that the ‘filters’ variable is passed as an array of numbers. The rest of the test code you referred me to is pasted below, can you point out here where the filters are defined?
np.random.seed(1)
X1 = np.ones((1, 4, 4, 3)) * -1
X2 = np.ones((1, 4, 4, 3)) * 1
X3 = np.ones((1, 4, 4, 3)) * 3
X = np.concatenate((X1, X2, X3), axis = 0).astype(np.float32)
A3 = identity_block(X, f=2, filters=[4, 4, 3],
initializer=lambda seed=0:constant(value=1),
training=False)
print(’\033[1mWith training=False\033[0m\n’)
A3np = A3.numpy()
print(np.around(A3.numpy()[:,(0,-1),:,:].mean(axis = 3), 5))
resume = A3np[:,(0,-1),:,:].mean(axis = 3)
print(resume[1, 1, 0])
print(’\n\033[1mWith training=True\033[0m\n’)
np.random.seed(1)
A4 = identity_block(X, f=2, filters=[3, 3, 3],
initializer=lambda seed=0:constant(value=1),
training=True)
print(np.around(A4.numpy()[:,(0,-1),:,:].mean(axis = 3), 5))
public_tests.identity_block_test(identity_block)
Thanks!