I ve been working on this assignment for hours but i still dont understand why im getting this error at question 1: TypeError: Cannot interpret feed_dict key as Tensor: Can not convert a Model into a Tensor.
i think the mistake is in one of those code lines but i dont find it, appreciate your help:
2. Get gradients of last layer with respect to output
# get the gradients of y_c with respect to the spatial map layer (it's a list of length 1)
grads_l = K.gradients(y_c, spatial_map_layer)
# Get the gradient at index 0 of the list
grads = grads_l[0]
# 3. Get hook for the selected layer and its gradient, based on given model's input
# Hint: Use the variables produced by the previous two lines of code
spatial_map_and_gradient_function = K.function([input_model], [spatial_map_layer, grads])
# Put in the image to calculate the values of the spatial_maps (selected layer) and values of the gradients
spatial_map_all_dims, grads_val_all_dims = spatial_map_and_gradient_function([image])