Skip to content

Commit 3cf2e42

Browse files
committed
remove more dead code
1 parent e6f2ba7 commit 3cf2e42

File tree

1 file changed

+0
-22
lines changed

1 file changed

+0
-22
lines changed

eli5/keras/gradcam.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -157,28 +157,6 @@ def gradcam_backend(
157157
return weights, activations, grads, predicted_idx, predicted_val
158158

159159

160-
def _calc_gradient(ys: tf.Tensor, xs: list[tf.Tensor]) -> tf.Tensor:
161-
"""
162-
Compute the gradient of a tensor w.r.t. given inputs and apply L2 normalization.
163-
164-
Parameters
165-
----------
166-
ys : tf.Tensor
167-
Tensor (typically scalar score) whose gradient is computed.
168-
xs : list of tf.Tensor
169-
List of tensors to differentiate with respect to (singleton list).
170-
171-
Returns
172-
-------
173-
tf.Tensor
174-
L2-normalized gradient tensor with same shape as xs[0].
175-
"""
176-
grads = tf.gradients(ys, xs)
177-
if not grads or grads[0] is None:
178-
raise ValueError(f"Gradient calculation resulted in None values. ys: {ys}, xs: {xs}.")
179-
return tf.math.l2_normalize(grads[0])
180-
181-
182160
def _validate_target(target: int, output_shape: tuple) -> None:
183161
"""
184162
Check whether ``target``,

0 commit comments

Comments
 (0)