1 /* 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. 7 */ 8 9 #include <executorch/kernels/test/FunctionHeaderWrapper.h> // Declares the operator 10 #include <executorch/kernels/test/UnaryUfuncRealHBBF16ToFloatHBF16Test.h> 11 12 #include <gtest/gtest.h> 13 14 #include <cmath> 15 16 using exec_aten::Tensor; 17 class OpLog1pOutTest 18 : public torch::executor::testing::UnaryUfuncRealHBBF16ToFloatHBF16Test { 19 protected: op_out(const Tensor & self,Tensor & out)20 Tensor& op_out(const Tensor& self, Tensor& out) override { 21 return torch::executor::aten::log1p_outf(context_, self, out); 22 } 23 op_reference(double x) const24 double op_reference(double x) const override { 25 return std::log1p(x); 26 } 27 28 torch::executor::testing::SupportedFeatures* get_supported_features() 29 const override; 30 }; 31 32 IMPLEMENT_UNARY_UFUNC_REALHB_TO_FLOATH_TEST(OpLog1pOutTest) 33