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