awslabs / awslabs/sagemaker-debugger

TF keras.py _wrap_tape_gradient breaks for arrays

Open
#446 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
165
Forks
82
PR merge metrics
No merged PRs in 30d

Description

I am passing in batches into tf.GradientTape() loop and calling my model for a prediction. When I call tape.gradient(prediction, batch), smdebug throws "ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()" for line 1209 at the file below.

https://github.com/awslabs/sagemaker-debugger/blob/master/smdebug/tensorflow/keras.py#L1209

Also, I am using tensorflow version 2.1. I am not sure if any updates can make it into the past versions (it looks like the AWS image I have started from used v0.9.3).

Currently I have uninstalled smdebug and it works as expected.

Contributor guide

Open the contributing guide

Research direction

Start at smdebug/tensorflow/keras.py line 1209 and reproduce the failure with TensorFlow 2.1, tf.GradientTape(), and array batches. Confirm that calling tape.gradient(prediction, batch) no longer raises the ambiguous truth-value error while smdebug is installed.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, tensorflow
Domain
machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.