NaN

#include <popops/NaN.hpp>

Test for NaN values in a tensor.

namespace popops

Common functions, such as elementwise and reductions.

Functions

poplar::Tensor hasNaN(poplar::Graph &graph, const poplar::Tensor &src, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Test for NaN values in a tensor.

Takes a tensor of any shape and type float or half and returns a new scalar bool tensor whose only element is true if any of the elements of the src tensor contained a NaN.

Parameters
  • graph – The graph to add the tensor and any vertices to.

  • src – The input tensor, the type must be floating point.

  • prog – Sequence to add programs to, which perform the check.

  • debugContext – Optional debug information.

poplar::Tensor hasNaNOrInf(poplar::Graph &graph, const poplar::Tensor &src, poplar::program::Sequence &prog, const poplar::DebugContext &debugContext = {})

Test for NaN or Inf values in a tensor.

Takes a tensor of any shape and type float or half and returns a new scalar bool tensor whose only element is true if any of the elements of the src tensor contained a NaN or an Inf.

Parameters
  • graph – The graph to add the tensor and any vertices to.

  • src – The input tensor, the type must be floating point.

  • prog – Sequence to add programs to, which perform the check.

  • debugContext – Optional debug information.