-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refine adam/strided_slice && fix doc for rmsprop/unstack #27740
Conversation
Thanks for your contribution! |
python/paddle/tensor/manipulation.py
Outdated
@@ -1461,3 +1460,92 @@ def gather_nd(x, index, name=None): | |||
""" | |||
|
|||
return paddle.fluid.layers.gather_nd(input=x, index=index, name=name) | |||
|
|||
|
|||
def strided_slice(x, axes, starts, ends, strides): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要加个 name
参数
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已添加
python/paddle/optimizer/adam.py
Outdated
|
||
Examples: | ||
.. code-block:: python | ||
|
||
import paddle | ||
import numpy as np | ||
|
||
paddle.disable_static() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这行可以删除,默认开启动态图了 然后下面function的示例代码也需要更新下
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复
python/paddle/optimizer/adam.py
Outdated
@@ -105,12 +103,10 @@ class Adam(Optimizer): | |||
|
|||
# Adam with beta1/beta2 as Tensor and weight_decay as float | |||
import paddle | |||
import numpy as np | |||
|
|||
paddle.disable_static() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复
python/paddle/optimizer/adam.py
Outdated
Returns: | ||
None | ||
|
||
Examples: | ||
.. code-block:: python | ||
|
||
import paddle | ||
import numpy as np | ||
paddle.disable_static() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复
python/paddle/optimizer/adamw.py
Outdated
**Notes**: | ||
**Currently, AdamW doesn't support sparse parameter optimization.** | ||
|
||
Examples: | ||
.. code-block:: python | ||
import paddle | ||
import numpy as np | ||
|
||
paddle.disable_static() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复
python/paddle/optimizer/rmsprop.py
Outdated
@@ -104,24 +104,19 @@ class RMSProp(Optimizer): | |||
.. code-block:: python | |||
|
|||
import paddle | |||
import numpy as np | |||
|
|||
paddle.disable_static() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复
python/paddle/tensor/manipulation.py
Outdated
Then: | ||
result = [ [2], ] | ||
Args: | ||
x (Variable): An N-D ``Tensor`` or ``LoDTensor`` . The data type is ``float32``, ``float64``, ``int32`` or ``int64``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable -> Tensor,不暴露LoDTensor概念
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已解决
python/paddle/tensor/manipulation.py
Outdated
x (Variable): An N-D ``Tensor`` or ``LoDTensor`` . The data type is ``float32``, ``float64``, ``int32`` or ``int64``. | ||
axes (list|tuple): The data type is ``int32`` . Axes that `starts` and `ends` apply to. | ||
It's optional. If it is not provides, it will be treated as :math:`[0,1,...,len(starts)-1]`. | ||
starts (list|tuple|Variable): The data type is ``int32`` . If ``starts`` is a list or tuple, the elements of it should be integers or Tensors with shape [1]. If ``starts`` is an Variable, it should be an 1-D Tensor. It represents starting indices of corresponding axis in ``axes``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已解决
python/paddle/tensor/manipulation.py
Outdated
axes (list|tuple): The data type is ``int32`` . Axes that `starts` and `ends` apply to. | ||
It's optional. If it is not provides, it will be treated as :math:`[0,1,...,len(starts)-1]`. | ||
starts (list|tuple|Variable): The data type is ``int32`` . If ``starts`` is a list or tuple, the elements of it should be integers or Tensors with shape [1]. If ``starts`` is an Variable, it should be an 1-D Tensor. It represents starting indices of corresponding axis in ``axes``. | ||
ends (list|tuple|Variable): The data type is ``int32`` . If ``ends`` is a list or tuple, the elements of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已解决
python/paddle/tensor/manipulation.py
Outdated
starts (list|tuple|Variable): The data type is ``int32`` . If ``starts`` is a list or tuple, the elements of it should be integers or Tensors with shape [1]. If ``starts`` is an Variable, it should be an 1-D Tensor. It represents starting indices of corresponding axis in ``axes``. | ||
ends (list|tuple|Variable): The data type is ``int32`` . If ``ends`` is a list or tuple, the elements of | ||
it should be integers or Tensors with shape [1]. If ``ends`` is an Variable, it should be an 1-D Tensor . It represents ending indices of corresponding axis in ``axes``. | ||
strides (list|tuple|Variable): The data type is ``int32`` . If ``strides`` is a list or tuple, the elements of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已解决
name(str, optional): The default value is None. Normally there is no need for user to set this property. | ||
For more information, please refer to :ref:`api_guide_Name` . | ||
|
||
Returns: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修复
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Please add core.ops
for unstack
in next PR.
…e#27740) * refine parameters order && doc * update rmsprop doc * refine adam/transpose/unstack/stride_slice * fix bug && doc * fix doc * bug fix * bug fix * fix doc * fix doc * fix doc * fix doc * depercate old strided_slice * update doc * set default value for name * update doc
PR types
Others
PR changes
APIs
Describe
修改adam和adamw op参数顺序,name放在最后
迁移stride_slice op,参数input 改为 x
修改rmsprop、unstack op文档中的示例代码
中文文档PR PaddlePaddle/docs#2748