// Copyright © Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #pragma once #include #include #include #include #include #include #include #include namespace hipdnn_gpu_ref { // Factory function to create a GPU allClose validator for the given data type. // Mirrors the createAllCloseValidator() API from CpuFpReferenceValidation.hpp. std::unique_ptr createGpuAllCloseValidator(hipdnn_frontend::DataType dataType, float absoluteTolerance = std::numeric_limits::epsilon(), float relativeTolerance = std::numeric_limits::epsilon()); // Templated factory function to create a GPU allClose validator. template inline std::unique_ptr // NOLINTNEXTLINE(readability-redundant-casting) - cast needed for non-float T types createGpuAllCloseValidator(float absoluteTolerance = float(std::numeric_limits::epsilon()), // NOLINTNEXTLINE(readability-redundant-casting) float relativeTolerance = float(std::numeric_limits::epsilon())) { if constexpr(std::is_integral_v) { return std::make_unique>(); } else { return std::make_unique>(absoluteTolerance, relativeTolerance); } } } // namespace hipdnn_gpu_ref