@@ -30,9 +30,10 @@ def jacobian(ys, xs, i=None, j=None):
3030 unless J has only one element, which is returned.
3131
3232 Returns:
33- (`i`, `j`)th entry J[`i`, `j`], `i`th row J[`i`, :], or `j`th column J[:, `j`],
34- with 2 dimension when ys of shape (batch_size, dim_y) or 3 dimension when
35- ys of shape (batch_size_out, batch_size, dim_y).
33+ (`i`, `j`)th entry J[`i`, `j`], `i`th row J[`i`, :], or `j`th column J[:, `j`].
34+ When `ys` has shape (batch_size, dim_y), the output shape is (batch_size, 1).
35+ When `ys` has shape (batch_size_out, batch_size, dim_y), the output shape is
36+ (batch_size_out, batch_size, 1).
3637 """
3738 if config .autodiff == "reverse" :
3839 return gradients_reverse .jacobian (ys , xs , i = i , j = j )
@@ -61,8 +62,9 @@ def hessian(ys, xs, component=0, i=0, j=0):
6162 j (int): `j`th column.
6263
6364 Returns:
64- H[`i`, `j`], with 2 dimension when ys of shape (batch_size, dim_y)
65- or 3 dimension when ys of shape (batch_size_out, batch_size, dim_y).
65+ H[`i`, `j`]. When `ys` has shape (batch_size, dim_y), the output shape is
66+ (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).
6668 """
6769 if config .autodiff == "reverse" :
6870 return gradients_reverse .hessian (ys , xs , component = component , i = i , j = j )
0 commit comments