Merge pull request #26142 from danaugrs:patch2
PiperOrigin-RevId: 237336877
This commit is contained in:
commit
90b561ef09
@ -358,6 +358,7 @@ class OptimizerV2(trackable.Trackable):
|
||||
ValueError: In case any gradient cannot be computed (e.g. if gradient
|
||||
function not implemented).
|
||||
"""
|
||||
with backend.get_graph().as_default():
|
||||
grads = gradients.gradients(loss, params)
|
||||
if None in grads:
|
||||
raise ValueError("An operation has `None` for gradient. "
|
||||
|
Loading…
Reference in New Issue
Block a user