From 18525d36351f871722f48a77d7fd9f8ecb5019f3 Mon Sep 17 00:00:00 2001 From: WangXi Date: Mon, 9 Nov 2020 14:05:51 +0800 Subject: [PATCH] fix Tanh remainder en doc (#28455) --- python/paddle/nn/layer/activation.py | 4 +--- python/paddle/tensor/math.py | 12 +++++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/python/paddle/nn/layer/activation.py b/python/paddle/nn/layer/activation.py index b0a1b27855a..32979bae34d 100644 --- a/python/paddle/nn/layer/activation.py +++ b/python/paddle/nn/layer/activation.py @@ -252,12 +252,10 @@ class Tanh(layers.Layer): import paddle import numpy as np - paddle.disable_static() - x = paddle.to_tensor(np.array([-0.4, -0.2, 0.1, 0.3])) m = paddle.nn.Tanh() out = m(x) - print(out.numpy()) + print(out) # [-0.37994896 -0.19737532 0.09966799 0.29131261] """ diff --git a/python/paddle/tensor/math.py b/python/paddle/tensor/math.py index c83e788538e..30ce55f009e 100755 --- a/python/paddle/tensor/math.py +++ b/python/paddle/tensor/math.py @@ -387,11 +387,11 @@ def remainder(x, y, name=None): out = x \% y **Note**: - ``paddle.remainder`` supports broadcasting. If you want know more about broadcasting, please refer to :ref:`user_guide_broadcasting` . + ``paddle.mod`` supports broadcasting. If you want know more about broadcasting, please refer to :ref:`user_guide_broadcasting` . Args: - x (Tensor): the input tensor, it's data type should be int32, int64. - y (Tensor): the input tensor, it's data type should be int32, int64. + x (Tensor): the input tensor, it's data type should be float32, float64, int32, int64. + y (Tensor): the input tensor, it's data type should be float32, float64, int32, int64. name (str, optional): Name for the operation (optional, default is None). For more information, please refer to :ref:`api_guide_Name`. Returns: @@ -403,12 +403,10 @@ def remainder(x, y, name=None): import paddle - paddle.disable_static() - x = paddle.to_tensor([2, 3, 8, 7]) y = paddle.to_tensor([1, 5, 3, 3]) - z = paddle.remainder(x, y) - print(z.numpy()) # [0, 3, 2, 1] + z = paddle.mod(x, y) + print(z) # [0, 3, 2, 1] """ op_type = 'elementwise_mod' -- GitLab