@@ -33,7 +33,8 @@ def jacobian(ys, xs, i=None, j=None):
3333 (`i`, `j`)th entry J[`i`, `j`], `i`th row J[`i`, :], or `j`th column J[:, `j`].
3434 When `ys` has shape (batch_size, dim_y), the output shape is (batch_size, 1).
3535 When `ys` has shape (batch_size_out, batch_size, dim_y), the output shape is
36- (batch_size_out, batch_size, 1).
36+ (batch_size_out, batch_size, 1) if forward-mode autodiff is used or
37+ (batch_size, 1) if reverse-mode autodiff is used.
3738 """
3839 if config .autodiff == "reverse" :
3940 return gradients_reverse .jacobian (ys , xs , i = i , j = j )
@@ -64,7 +65,8 @@ def hessian(ys, xs, component=0, i=0, j=0):
6465 Returns:
6566 H[`i`, `j`]. When `ys` has shape (batch_size, dim_y), the output shape is
6667 (batch_size, 1). When `ys` has shape (batch_size_out, batch_size, dim_y),
67- the output shape is (batch_size_out, batch_size, 1).
68+ the output shape is (batch_size_out, batch_size, 1) if forward-mode
69+ autodiff is used or (batch_size, 1) if reverse-mode autodiff is used.
6870 """
6971 if config .autodiff == "reverse" :
7072 return gradients_reverse .hessian (ys , xs , component = component , i = i , j = j )
0 commit comments