Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tf_explain/core/grad_cam.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def infer_grad_cam_target_layer(model):
"""
for layer in reversed(model.layers):
# Select closest 4D layer to the end of the network.
if len(layer.output_shape) == 4:
if len(layer.output.shape) == 4:
return layer.name

raise ValueError(
Expand All @@ -108,7 +108,7 @@ def get_gradients_and_filters(
Tuple[tf.Tensor, tf.Tensor]: (Target layer outputs, Guided gradients)
"""
grad_model = tf.keras.models.Model(
[model.inputs], [model.get_layer(layer_name).output, model.output]
model.inputs, [model.get_layer(layer_name).output, model.output]
)

with tf.GradientTape() as tape:
Expand Down