Skip to content

Commit 42758a3

Browse files
committed
update code
1 parent 8d3a7b9 commit 42758a3

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

deepxde/gradients/gradients_reverse.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,15 @@ class Hessian:
100100
def __init__(self, ys, xs, component=0):
101101
if backend_name in ["tensorflow.compat.v1", "tensorflow", "pytorch", "paddle"]:
102102
dim_y = ys.shape[1]
103-
ndim_y = bkd.ndim(ys)
104103
elif backend_name == "jax":
105104
dim_y = ys[0].shape[1]
106-
ndim_y = bkd.ndim(ys[0])
107105
if component >= dim_y:
108106
raise ValueError(
109107
"The component of ys={} cannot be larger than the dimension={}.".format(
110108
component, dim_y
111109
)
112110
)
113-
if ndim_y == 3:
114-
raise NotImplementedError(
115-
"Reverse-mode autodiff doesn't support 3D output"
116-
)
111+
117112
# There is no duplicate computation of grad_y.
118113
grad_y = jacobian(ys, xs, i=component, j=None)
119114
self.H = JacobianReverse(grad_y, xs)

0 commit comments

Comments
 (0)