isfinite.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include "ultra_infer/core/fd_tensor.h"
  16. namespace ultra_infer {
  17. namespace function {
  18. /** Return whether every element of input tensor is NaN or not.
  19. @param x The input tensor.
  20. @param out The output tensor which stores the result.
  21. @param dtype The output data type
  22. */
  23. ULTRAINFER_DECL void IsNan(const FDTensor &x, FDTensor *out,
  24. FDDataType dtype = FDDataType::BOOL);
  25. /** Return whether every element of input tensor is Inf or not.
  26. @param x The input tensor.
  27. @param out The output tensor which stores the result.
  28. @param dtype The output data type
  29. */
  30. ULTRAINFER_DECL void IsInf(const FDTensor &x, FDTensor *out,
  31. FDDataType dtype = FDDataType::BOOL);
  32. /** Return whether every element of input tensor is finite or not.
  33. @param x The input tensor.
  34. @param out The output tensor which stores the result.
  35. @param dtype The output data type
  36. */
  37. ULTRAINFER_DECL void IsFinite(const FDTensor &x, FDTensor *out,
  38. FDDataType dtype = FDDataType::BOOL);
  39. } // namespace function
  40. } // namespace ultra_infer