<commit_before>#   Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ..fluid.layer_helper import LayerHelper
from ..fluid.data_feeder import check_type, check_variable_and_dtype
from ..fluid.layers.layer_function_generator import templatedoc
from .. import fluid
from ..fluid.framework import in_dygraph_mode
from paddle.common_ops_import import *

# TODO: define logic functions of a tensor  
from ..fluid.layers import is_empty  #DEFINE_ALIAS
from ..fluid.layers import isfinite  #DEFINE_ALIAS
from ..fluid.layers import logical_and  #DEFINE_ALIAS
from ..fluid.layers import logical_not  #DEFINE_ALIAS
from ..fluid.layers import logical_or  #DEFINE_ALIAS
from ..fluid.layers import logical_xor  #DEFINE_ALIAS
from ..fluid.layers import reduce_all  #DEFINE_ALIAS
from ..fluid.layers import reduce_any  #DEFINE_ALIAS

__all__ = [
    'equal',
    'equal_all',
    'greater_equal',
    'greater_than',
    'is_empty',
    'isfinite',
    'less_equal',
    'less_than',
    'logical_and',
    'logical_not',
    'logical_or',
    'logical_xor',
    'not_equal',
    'reduce_all',
    'reduce_any',
    'allclose',
    #       'isnan'
]


def equal_all(x, y, name=None):
    """
	:alias_main: paddle.equal_all
	:alias: paddle.equal_all,paddle.tensor.equal_all,paddle.tensor.logic.equal_all

    This OP returns the truth value of :math:`x == y`. True if two inputs have the same elements, False otherwise.

    **NOTICE**: The output of this OP has no gradient.

    Args:
        x(Tensor): Tensor, data type is float32, float64, int32, int64.
        y(Tensor): Tensor, data type is float32, float64, int32, int64.
        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:
        Tensor: output Tensor, data type is bool, value is [False] or [True].

    Examples:
        .. code-block:: python

          import numpy as np
          import paddle

          paddle.disable_static()
          x = paddle.to_variable(np.array([1, 2, 3]))
          y = paddle.to_variable(np.array([1, 2, 3]))
          z = paddle.to_variable(np.array([1, 4, 3]))
          result1 = paddle.equal_all(x, y)
          print(result1.numpy()) # result1 = [True ]
          result2 = paddle.equal_all(x, z)
          print(result2.numpy()) # result2 = [False ]
    """

    helper = LayerHelper("equal_all", **locals())
    out = helper.create_variable_for_type_inference(dtype='bool')
    helper.append_op(
        type='equal_all', inputs={'X': [x],
                                  'Y': [y]}, outputs={'Out': [out]})
    return out


@templatedoc()
def allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name=None):
    """
	:alias_main: paddle.allclose
	:alias: paddle.allclose,paddle.tensor.allclose,paddle.tensor.logic.allclose

    ${comment}

    Args:
        x(Tensor): ${input_comment}.
        y(Tensor): ${other_comment}.
        rtol(rtoltype, optional): ${rtol_comment}.
        atol(atoltype, optional): ${atol_comment}.
        equal_nan(equalnantype, optional): ${equal_nan_comment}.
        name (str, optional): Name for the operation. For more information, please
            refer to :ref:`api_guide_Name`. Default: None.
<commit_msg>remove alias from doc, test=document_fix (#26487)<commit_after>#   Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from ..fluid.layer_helper import LayerHelper
from ..fluid.data_feeder import check_type, check_variable_and_dtype
from ..fluid.layers.layer_function_generator import templatedoc
from .. import fluid
from ..fluid.framework import in_dygraph_mode
from paddle.common_ops_import import *

# TODO: define logic functions of a tensor  
from ..fluid.layers import is_empty  #DEFINE_ALIAS
from ..fluid.layers import isfinite  #DEFINE_ALIAS
from ..fluid.layers import logical_and  #DEFINE_ALIAS
from ..fluid.layers import logical_not  #DEFINE_ALIAS
from ..fluid.layers import logical_or  #DEFINE_ALIAS
from ..fluid.layers import logical_xor  #DEFINE_ALIAS
from ..fluid.layers import reduce_all  #DEFINE_ALIAS
from ..fluid.layers import reduce_any  #DEFINE_ALIAS

__all__ = [
    'equal',
    'equal_all',
    'greater_equal',
    'greater_than',
    'is_empty',
    'isfinite',
    'less_equal',
    'less_than',
    'logical_and',
    'logical_not',
    'logical_or',
    'logical_xor',
    'not_equal',
    'reduce_all',
    'reduce_any',
    'allclose',
    #       'isnan'
]


def equal_all(x, y, name=None):
    """
	:alias_main: paddle.equal_all
	:alias: paddle.equal_all,paddle.tensor.equal_all,paddle.tensor.logic.equal_all

    This OP returns the truth value of :math:`x == y`. True if two inputs have the same elements, False otherwise.

    **NOTICE**: The output of this OP has no gradient.

    Args:
        x(Tensor): Tensor, data type is float32, float64, int32, int64.
        y(Tensor): Tensor, data type is float32, float64, int32, int64.
        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:
        Tensor: output Tensor, data type is bool, value is [False] or [True].

    Examples:
        .. code-block:: python

          import numpy as np
          import paddle

          paddle.disable_static()
          x = paddle.to_variable(np.array([1, 2, 3]))
          y = paddle.to_variable(np.array([1, 2, 3]))
          z = paddle.to_variable(np.array([1, 4, 3]))
          result1 = paddle.equal_all(x, y)
          print(result1.numpy()) # result1 = [True ]
          result2 = paddle.equal_all(x, z)
          print(result2.numpy()) # result2 = [False ]
    """

    helper = LayerHelper("equal_all", **locals())
    out = helper.create_variable_for_type_inference(dtype='bool')
    helper.append_op(
        type='equal_all', inputs={'X': [x],
                                  'Y': [y]}, outputs={'Out': [out]})
    return out


@templatedoc()
def allclose(x, y, rtol=1e-05, atol=1e-08, equal_nan=False, name=None):
    """
    ${comment}

    Args:
        x(Tensor): ${input_comment}.
        y(Tensor): ${other_comment}.
        rtol(rtoltype, optional): ${rtol_comment}.
        atol(atoltype, optional): ${atol_comment}.
        equal_nan(equalnantype, optional): ${equal_nan_comment}.
        name (str, optional): Name for the operation. For more information, please
            refer to :ref:`api_guide_Name`. Default: None.

{'fraction_non_alphanumeric': 0.1125098347757671, 'fraction_numerical': 0.012457382638342512, 'mean_word_length': 3.1496191512513603, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1980553', 'n_tokens_mistral': 2482, 'n_tokens_neox': 2346, 'n_words': 721}