From d6efd9cb7d89118eeddc3d51adc5e7c035a12755 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Thu, 11 May 2023 12:28:14 +0000 Subject: [PATCH 1/3] fix jacobian and hessian's docstring --- python/paddle/autograd/autograd.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/paddle/autograd/autograd.py b/python/paddle/autograd/autograd.py index cfd5442138c3a..46aa8d0f47c26 100644 --- a/python/paddle/autograd/autograd.py +++ b/python/paddle/autograd/autograd.py @@ -465,12 +465,12 @@ def jacobian( The ``xs`` tuples are identical in one-to-one correspondence. - When ``batch_axis=None``, only 0-dimensional Tensor or 1-dimensional Tensor is - supported, assuming the shape of ``xs`` is ``[N, ]``, the shape of ``ys`` is - ``[M, ]``, then the output Jacobian matrix shape is ``[M, N]``. + supported, assuming the shape of ``xs`` is ``[N, ]``, the shape of ``ys`` is + ``[M, ]``, then the output Jacobian matrix shape is ``[M, N]``. - When ``batch_axis=0``, only 1-dimensional Tensor or 2-dimensional Tensor is - supported, assuming the shape of ``xs`` is ``[B, N]``, The shape of ``ys`` is - ``[B, M]``, then the output Jacobian matrix shape is ``[B, M, N]``. + supported, assuming the shape of ``xs`` is ``[B, N]``, The shape of ``ys`` is + ``[B, M]``, then the output Jacobian matrix shape is ``[B, M, N]``. After the ``Jacobian`` object is created, the actual calculation process does not occur, but the lazy evaluation method is used for calculation. It can be @@ -558,10 +558,10 @@ def hessian( ``(([M1, M1], [M1, M2]), ([M2, M1], [M2, M2]))`` - When ``batch_axis=None``, only 0-dimensional Tensor or 1-dimensional Tensor is - supported, assuming that the shape of ``xs`` is ``[N, ]``, and the shape of ``ys`` is ``[ ]``(0-dimensional Tensor), the final output is a single Hessian matrix whose shape is ``[N, N]``. + supported, assuming that the shape of ``xs`` is ``[N, ]``, and the shape of ``ys`` is ``[ ]``(0-dimensional Tensor), the final output is a single Hessian matrix whose shape is ``[N, N]``. - When ``batch_axis=0``, only 1-dimensional Tensor or 2-dimensional Tensor is - supported, assuming that the shape of ``xs`` is ``[B, N]``, and the shape of ``ys`` is `` [B, ]``, the final output Jacobian matrix shape is ``[B, N, N]``. + supported, assuming that the shape of ``xs`` is ``[B, N]``, and the shape of ``ys`` is `` [B, ]``, the final output Jacobian matrix shape is ``[B, N, N]``. After the ``Hessian`` object is created, the complete calculation process does not occur, but a partial lazy evaluation method is used for calculation. It can be From b665ae21528450be798d44649568ec291d4e98f5 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Thu, 11 May 2023 16:00:44 +0000 Subject: [PATCH 2/3] fix hessian's docstring --- python/paddle/autograd/autograd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/autograd/autograd.py b/python/paddle/autograd/autograd.py index 46aa8d0f47c26..f5e3484dd824f 100644 --- a/python/paddle/autograd/autograd.py +++ b/python/paddle/autograd/autograd.py @@ -554,11 +554,11 @@ def hessian( When the input ``xs`` is a Tensor tuple, the returned result is a ``Hessian`` tuple, assuming that the internal shape of the ``xs`` tuple is composed of - ``([M1, ], [M2, ]) ``, the shape of the returned result consists of + ``([M1, ], [M2, ])``, the shape of the returned result consists of ``(([M1, M1], [M1, M2]), ([M2, M1], [M2, M2]))`` - When ``batch_axis=None``, only 0-dimensional Tensor or 1-dimensional Tensor is - supported, assuming that the shape of ``xs`` is ``[N, ]``, and the shape of ``ys`` is ``[ ]``(0-dimensional Tensor), the final output is a single Hessian matrix whose shape is ``[N, N]``. + supported, assuming that the shape of ``xs`` is ``[N, ]``, and the shape of ``ys`` is ``[ ]`` (0-dimensional Tensor), the final output is a single Hessian matrix whose shape is ``[N, N]``. - When ``batch_axis=0``, only 1-dimensional Tensor or 2-dimensional Tensor is supported, assuming that the shape of ``xs`` is ``[B, N]``, and the shape of ``ys`` is `` [B, ]``, the final output Jacobian matrix shape is ``[B, N, N]``. From 0eace85ac82ffafb4ddec3b2c8b7ea6510a9ee17 Mon Sep 17 00:00:00 2001 From: HydrogenSulfate <490868991@qq.com> Date: Thu, 11 May 2023 16:15:33 +0000 Subject: [PATCH 3/3] fix hessian's docstring --- python/paddle/autograd/autograd.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/python/paddle/autograd/autograd.py b/python/paddle/autograd/autograd.py index f5e3484dd824f..e61a7ff009294 100644 --- a/python/paddle/autograd/autograd.py +++ b/python/paddle/autograd/autograd.py @@ -553,15 +553,14 @@ def hessian( ``batch_axis`` means The position of the batch dimension of the parameter data. When the input ``xs`` is a Tensor tuple, the returned result is a ``Hessian`` tuple, - assuming that the internal shape of the ``xs`` tuple is composed of - ``([M1, ], [M2, ])``, the shape of the returned result consists of - ``(([M1, M1], [M1, M2]), ([M2, M1], [M2, M2]))`` + assuming that the internal shape of the ``xs`` tuple is composed of ``([M1, ], [M2, ])``, the shape of the returned + result consists of ``(([M1, M1], [M1, M2]), ([M2, M1], [M2, M2]))`` - When ``batch_axis=None``, only 0-dimensional Tensor or 1-dimensional Tensor is supported, assuming that the shape of ``xs`` is ``[N, ]``, and the shape of ``ys`` is ``[ ]`` (0-dimensional Tensor), the final output is a single Hessian matrix whose shape is ``[N, N]``. - When ``batch_axis=0``, only 1-dimensional Tensor or 2-dimensional Tensor is - supported, assuming that the shape of ``xs`` is ``[B, N]``, and the shape of ``ys`` is `` [B, ]``, the final output Jacobian matrix shape is ``[B, N, N]``. + supported, assuming that the shape of ``xs`` is ``[B, N]``, and the shape of ``ys`` is ``[B, ]``, the final output Jacobian matrix shape is ``[B, N, N]``. After the ``Hessian`` object is created, the complete calculation process does not occur, but a partial lazy evaluation method is used for calculation. It can be