From: Donghyeon Jeong Date: Wed, 16 Aug 2023 06:08:42 +0000 (+0900) Subject: [Tensor] Fix in Mixed Precision Support X-Git-Tag: accepted/tizen/8.0/unified/20231005.093407~51 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6bfdfa54f76c288bd97fb2aca88d183c721de250;p=platform%2Fcore%2Fml%2Fnntrainer.git [Tensor] Fix in Mixed Precision Support - Fix unchanged works in mixed precision support - Remove unused code Signed-off-by: Donghyeon Jeong --- diff --git a/api/ccapi/include/tensor_dim.h b/api/ccapi/include/tensor_dim.h index 5847b8d..93a3560 100644 --- a/api/ccapi/include/tensor_dim.h +++ b/api/ccapi/include/tensor_dim.h @@ -124,10 +124,6 @@ public: TensorDim(std::initializer_list dims, TensorType t_type_ = TensorType()); - // TensorDim(std::initializer_list dims, TensorDim::Format - // fm=Format::NCHW, - // TensorDim::DataType d_type=DataType::FP32); - /** * @brief Construct a new Tensor Dim object without batch dimension * @@ -137,10 +133,6 @@ public: TensorDim(const std::array &shapes, TensorType t_type_ = TensorType()); - // TensorDim(const std::array &shapes, TensorDim::Format fm = - // Format::NCHW, - // TensorDim::DataType d_type=DataType::FP32); - /** * @brief Construct a new Tensor Dim object * diff --git a/nntrainer/dataset/databuffer.cpp b/nntrainer/dataset/databuffer.cpp index 3143ae1..f58ce05 100644 --- a/nntrainer/dataset/databuffer.cpp +++ b/nntrainer/dataset/databuffer.cpp @@ -64,7 +64,6 @@ DataBuffer::DataBuffer(std::unique_ptr &&producer_) : producer(std::move(producer_)), db_props(new Props()), user_data(nullptr) { - // rng.seed(getSeed()); rng.seed(0); } diff --git a/nntrainer/dataset/random_data_producers.cpp b/nntrainer/dataset/random_data_producers.cpp index 6c03fa1..73d0462 100644 --- a/nntrainer/dataset/random_data_producers.cpp +++ b/nntrainer/dataset/random_data_producers.cpp @@ -126,7 +126,6 @@ RandomDataOneHotProducer::finalize(const std::vector &input_dims, }); std::mt19937 rng; - // rng.seed(getSeed()); rng.seed(0); auto sz = size(input_dims, input_dims); diff --git a/nntrainer/graph/network_graph.cpp b/nntrainer/graph/network_graph.cpp index 450728f..87db95b 100644 --- a/nntrainer/graph/network_graph.cpp +++ b/nntrainer/graph/network_graph.cpp @@ -666,9 +666,8 @@ NetworkGraph::canExecuteInPlace(const std::shared_ptr &lnode) { * inplace. We assume that the input is always FP32. */ if (lnode->getInputConnections().empty()) { - if (!istrequal(getTensorType()[3], "FP32")) + if (!istrequal(getTensorType()[2], "FP32")) return InPlace::NONE; - } return InPlace::NONE; diff --git a/nntrainer/layers/conv2d_layer.cpp b/nntrainer/layers/conv2d_layer.cpp index 9b245a0..f90bd6b 100644 --- a/nntrainer/layers/conv2d_layer.cpp +++ b/nntrainer/layers/conv2d_layer.cpp @@ -102,7 +102,7 @@ static void col2im(const Tensor &col_matrix, const TensorDim &kdim, continue; } - float *val = (float *)image.getAddress(0, c, h, w); + float *val = image.getAddress(0, c, h, w); *val += col_matrix.getValue(0, 0, col_h, col_w); col_h++; } diff --git a/nntrainer/layers/embedding.cpp b/nntrainer/layers/embedding.cpp index 46136e0..4cec7db 100644 --- a/nntrainer/layers/embedding.cpp +++ b/nntrainer/layers/embedding.cpp @@ -88,7 +88,7 @@ void EmbeddingLayer::forwarding(RunLayerContext &context, bool training) { for (unsigned int b = 0; b < input_.batch(); ++b) { float *in_data = - (float *)input_.getAddress(b * input_.getDim().getFeatureLen()); + input_.getAddress(b * input_.getDim().getFeatureLen()); Tensor batchsliced_hidden = hidden_.getBatchSlice(b, 1); for (unsigned int i = 0; i < input_.width(); ++i) { @@ -146,7 +146,7 @@ void EmbeddingLayer::calcGradient(RunLayerContext &context) { // In order to accelerate, we need to better way like using index to weight. for (unsigned int b = 0; b < input_.batch(); ++b) { - float *in_data = (float*)input_.getAddress(b * input_.getDim().getFeatureLen()); + float *in_data = input_.getAddress(b * input_.getDim().getFeatureLen()); for (unsigned int i = 0; i < input_.width(); ++i) { uint embed_idx = ((uint *)(in_data))[i]; @@ -155,8 +155,8 @@ void EmbeddingLayer::calcGradient(RunLayerContext &context) { // if (embed_idx == 0) // continue; - float *djdw_data = (float*)djdw.getAddress(embed_idx * out_dim); - const float *grad_data = (float*)derivative_.getAddress( + float *djdw_data = djdw.getAddress(embed_idx * out_dim); + const float *grad_data = derivative_.getAddress( b * derivative_.getDim().getFeatureLen() + i * out_dim); std::transform(djdw_data, djdw_data + out_dim, grad_data, djdw_data, diff --git a/nntrainer/tensor/tensor.cpp b/nntrainer/tensor/tensor.cpp index 6246f78..0444dcb 100644 --- a/nntrainer/tensor/tensor.cpp +++ b/nntrainer/tensor/tensor.cpp @@ -2607,7 +2607,7 @@ void Tensor::print(std::ostream &out) const { out << "data addr: " << data << '\n'; out << dim; - if (len > 100000) { + if (len > 100) { out << '[' << data[0] << ' ' << data[1] << ' ' << data[2] << " ... " << data[len - 3] << ' ' << data[len - 2] << ' ' << data[len - 1] << ']' << std::endl; @@ -3250,7 +3250,8 @@ void Tensor::standardization_i() { this->subtract_i(mean_by_batch); if (getDataType() == ml::train::TensorDim::DataType::FP32) { - Tensor std_dev_by_batch(dim.batch(), 1, 1, 1); + Tensor std_dev_by_batch(dim.batch(), 1, 1, 1, dim.getFormat(), + dim.getDataType()); std_dev_by_batch.setZero(); float *std_dev = std_dev_by_batch.getData(); @@ -3263,7 +3264,8 @@ void Tensor::standardization_i() { this->divide_i(std_dev_by_batch); } else if (getDataType() == ml::train::TensorDim::DataType::FP16) { #ifdef ENABLE_FP16 - Tensor std_dev_by_batch(dim.batch(), 1, 1, 1); + Tensor std_dev_by_batch(dim.batch(), 1, 1, 1, dim.getFormat(), + dim.getDataType()); std_dev_by_batch.setZero(); _FP16 *std_dev = std_dev_by_batch.getData<_FP16>(); diff --git a/nntrainer/utils/util_func.h b/nntrainer/utils/util_func.h index d7704c0..ba0dc1a 100644 --- a/nntrainer/utils/util_func.h +++ b/nntrainer/utils/util_func.h @@ -95,8 +95,6 @@ double sqrtDouble(double x); * @brief log function for float type * @param[in] x float */ -float logFloat(float x); - template T logFloat(T x) { return static_cast(log(x + 1.0e-20)); } @@ -105,7 +103,6 @@ template T logFloat(T x) { * @brief exp function for float type * @param[in] x float */ - template T exp_util(T x) { return static_cast(exp(x)); } /** diff --git a/test/jni/README.md b/test/jni/README.md new file mode 100644 index 0000000..5915683 --- /dev/null +++ b/test/jni/README.md @@ -0,0 +1,15 @@ +--- +title: Test JNI +... + +# Test + + +In order to enable the gtest in android, you need to add the googletest source in ndk in this directory. + +please do + +``` bash +#cp ${ANDROIND_SDK_HOME}/Sdk/ndk/${NDK_VERSION}/sources/third_party/googletest . +``` + diff --git a/test/unittest/layers/unittest_layers_zoneout_lstmcell.cpp b/test/unittest/layers/unittest_layers_zoneout_lstmcell.cpp index e31df5f..9f5584e 100644 --- a/test/unittest/layers/unittest_layers_zoneout_lstmcell.cpp +++ b/test/unittest/layers/unittest_layers_zoneout_lstmcell.cpp @@ -30,7 +30,7 @@ auto zoneout_lstmcell_single_step = LayerGoldenTestParamType( {"unit=5", "integrate_bias=true", "hidden_state_zoneout_rate=0.1", "cell_state_zoneout_rate=0.0"}, "3:1:1:7,3:1:1:5,3:1:1:5", "zoneout_lstmcell_single_step.nnlayergolden", - LayerGoldenTestParamOptions::DEFAULT, "nchw", "fp32"); + LayerGoldenTestParamOptions::DEFAULT, "nchw", "fp32", "fp32"); INSTANTIATE_TEST_CASE_P(LSTMCell, LayerGoldenTest, ::testing::Values(zoneout_lstmcell_single_step)); diff --git a/test/unittest/unittest_nntrainer_tensor.cpp b/test/unittest/unittest_nntrainer_tensor.cpp index 305b052..17ae168 100644 --- a/test/unittest/unittest_nntrainer_tensor.cpp +++ b/test/unittest/unittest_nntrainer_tensor.cpp @@ -179,8 +179,8 @@ TEST(nntrainer_Tensor, Tensor_03_p) { in.push_back(ttv); } - nntrainer::Tensor tensor = - nntrainer::Tensor(in, {nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP32}); + nntrainer::Tensor tensor = nntrainer::Tensor( + in, {nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP32}); ASSERT_NE(nullptr, tensor.getData()); if (tensor.getValue(0, 0, 0, 1) != 1.0) @@ -198,11 +198,8 @@ TEST(nntrainer_Tensor, multiply_i_01_p) { nntrainer::Tensor input(batch, channel, height, width); GEN_TEST_INPUT(input, i * (batch * height) + j * (width) + k); - input.print(std::cout); - nntrainer::Tensor original; original.copy(input); - original.print(std::cout); status = input.multiply_i(2.0); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2180,7 +2177,7 @@ TEST(nntrainer_Tensor, average_p) { EXPECT_EQ(actual, expected); int idx = 0; - t = t.apply((std::function)[&](float in) { return idx++ % 2; }); + t = t.apply((std::function)[&](float in) { return idx++ % 2; }); actual = t.average(); expected = constant(0.5, 1, 1, 1, 1); diff --git a/test/unittest/unittest_nntrainer_tensor_fp16.cpp b/test/unittest/unittest_nntrainer_tensor_fp16.cpp index 43e8789..eda4b63 100644 --- a/test/unittest/unittest_nntrainer_tensor_fp16.cpp +++ b/test/unittest/unittest_nntrainer_tensor_fp16.cpp @@ -24,8 +24,8 @@ TEST(nntrainer_Tensor, Tensor_01_fp16_p) { nntrainer::Tensor tensor = nntrainer::Tensor( 1, 2, 3, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); tensor.setZero(); - ASSERT_NE(nullptr, tensor.getData<_Float16>()); - if (tensor.getValue<_Float16>(0, 0, 0, 0) != 0.0) + ASSERT_NE(nullptr, tensor.getData<_FP16>()); + if (tensor.getValue<_FP16>(0, 0, 0, 0) != 0.0) status = ML_ERROR_INVALID_PARAMETER; EXPECT_EQ(status, ML_ERROR_NONE); } @@ -35,8 +35,8 @@ TEST(nntrainer_Tensor, Tensor_01_nhwc_fp16_p) { nntrainer::Tensor tensor = nntrainer::Tensor( 1, 2, 3, nntrainer::Tformat::NHWC, nntrainer::Tdatatype::FP16); tensor.setZero(); - ASSERT_NE(nullptr, tensor.getData<_Float16>()); - if (tensor.getValue<_Float16>(0, 0, 0, 0) != 0.0) + ASSERT_NE(nullptr, tensor.getData<_FP16>()); + if (tensor.getValue<_FP16>(0, 0, 0, 0) != 0.0) status = ML_ERROR_INVALID_PARAMETER; EXPECT_EQ(status, ML_ERROR_NONE); } @@ -45,11 +45,11 @@ TEST(nntrainer_Tensor, Tensor_02_fp16_p) { int status = ML_ERROR_NONE; int height = 3; int width = 10; - std::vector> in; + std::vector> in; for (int i = 0; i < height; ++i) { - std::vector<_Float16> tv; + std::vector<_FP16> tv; for (int j = 0; j < width; ++j) { - tv.push_back(static_cast<_Float16>(i * 2.0 + j)); + tv.push_back(static_cast<_FP16>(i * 2.0 + j)); } in.push_back(tv); } @@ -57,9 +57,9 @@ TEST(nntrainer_Tensor, Tensor_02_fp16_p) { nntrainer::Tensor tensor = nntrainer::Tensor(in, {ml::train::TensorDim::Format::NCHW, ml::train::TensorDim::DataType::FP16}); - ASSERT_NE(nullptr, tensor.getData<_Float16>()); + ASSERT_NE(nullptr, tensor.getData<_FP16>()); - if (tensor.getValue<_Float16>(0, 0, 0, 1) != 1.0) + if (tensor.getValue<_FP16>(0, 0, 0, 1) != 1.0) status = ML_ERROR_INVALID_PARAMETER; EXPECT_EQ(status, ML_ERROR_NONE); } @@ -69,11 +69,11 @@ TEST(nntrainer_Tensor, Tensor_03_fp16_p) { int batch = 3; int height = 3; int width = 10; - std::vector>> in; + std::vector>> in; for (int k = 0; k < batch; ++k) { - std::vector> ttv; + std::vector> ttv; for (int i = 0; i < height; ++i) { - std::vector<_Float16> tv; + std::vector<_FP16> tv; for (int j = 0; j < width; ++j) { tv.push_back(k * height * width + i * width + j); } @@ -85,9 +85,9 @@ TEST(nntrainer_Tensor, Tensor_03_fp16_p) { nntrainer::Tensor tensor = nntrainer::Tensor(in, {ml::train::TensorDim::Format::NCHW, ml::train::TensorDim::DataType::FP16}); - ASSERT_NE(nullptr, tensor.getData<_Float16>()); + ASSERT_NE(nullptr, tensor.getData<_FP16>()); - if (tensor.getValue<_Float16>(0, 0, 0, 1) != 1.0) + if (tensor.getValue<_FP16>(0, 0, 0, 1) != 1.0) status = ML_ERROR_INVALID_PARAMETER; EXPECT_EQ(status, ML_ERROR_NONE); } @@ -112,9 +112,9 @@ TEST(nntrainer_Tensor, multiply_i_01_fp16_p) { EXPECT_EQ(status, ML_ERROR_NONE); input.print(std::cout); - _Float16 *data = original.getData<_Float16>(); + _FP16 *data = original.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width * channel; ++i) { @@ -139,9 +139,9 @@ TEST(nntrainer_Tensor, multiply_i_02_fp16_p) { status = input.multiply_i(input); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *data = original.getData<_Float16>(); + _FP16 *data = original.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width * channel; ++i) { @@ -176,67 +176,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(4), static_cast<_Float16>(9), - static_cast<_Float16>(16), static_cast<_Float16>(25), - static_cast<_Float16>(36), static_cast<_Float16>(49), - static_cast<_Float16>(64), static_cast<_Float16>(81), - static_cast<_Float16>(100), static_cast<_Float16>(121), - static_cast<_Float16>(144), static_cast<_Float16>(169), - static_cast<_Float16>(196), static_cast<_Float16>(225), - static_cast<_Float16>(256), static_cast<_Float16>(289), - static_cast<_Float16>(324), static_cast<_Float16>(361), - static_cast<_Float16>(400), static_cast<_Float16>(441), - static_cast<_Float16>(484), static_cast<_Float16>(529), - static_cast<_Float16>(576), static_cast<_Float16>(625), - static_cast<_Float16>(676), static_cast<_Float16>(729), - static_cast<_Float16>(784), static_cast<_Float16>(841), - static_cast<_Float16>(900), static_cast<_Float16>(961), - static_cast<_Float16>(1024), static_cast<_Float16>(1089), - static_cast<_Float16>(1156), static_cast<_Float16>(1225), - static_cast<_Float16>(1296), static_cast<_Float16>(1369), - static_cast<_Float16>(1444), static_cast<_Float16>(1521), - static_cast<_Float16>(0), static_cast<_Float16>(41), - static_cast<_Float16>(84), static_cast<_Float16>(129), - static_cast<_Float16>(176), static_cast<_Float16>(225), - static_cast<_Float16>(276), static_cast<_Float16>(329), - static_cast<_Float16>(384), static_cast<_Float16>(441), - static_cast<_Float16>(500), static_cast<_Float16>(561), - static_cast<_Float16>(624), static_cast<_Float16>(689), - static_cast<_Float16>(756), static_cast<_Float16>(825), - static_cast<_Float16>(896), static_cast<_Float16>(969), - static_cast<_Float16>(1044), static_cast<_Float16>(1121), - static_cast<_Float16>(1200), static_cast<_Float16>(1281), - static_cast<_Float16>(1364), static_cast<_Float16>(1449), - static_cast<_Float16>(1536), static_cast<_Float16>(1625), - static_cast<_Float16>(1716), static_cast<_Float16>(1809), - static_cast<_Float16>(1904), static_cast<_Float16>(2001), - static_cast<_Float16>(2100), static_cast<_Float16>(2201), - static_cast<_Float16>(2304), static_cast<_Float16>(2409), - static_cast<_Float16>(2516), static_cast<_Float16>(2625), - static_cast<_Float16>(2736), static_cast<_Float16>(2849), - static_cast<_Float16>(2964), static_cast<_Float16>(3081), - static_cast<_Float16>(0), static_cast<_Float16>(81), - static_cast<_Float16>(164), static_cast<_Float16>(249), - static_cast<_Float16>(336), static_cast<_Float16>(425), - static_cast<_Float16>(516), static_cast<_Float16>(609), - static_cast<_Float16>(704), static_cast<_Float16>(801), - static_cast<_Float16>(900), static_cast<_Float16>(1001), - static_cast<_Float16>(1104), static_cast<_Float16>(1209), - static_cast<_Float16>(1316), static_cast<_Float16>(1425), - static_cast<_Float16>(1536), static_cast<_Float16>(1649), - static_cast<_Float16>(1764), static_cast<_Float16>(1881), - static_cast<_Float16>(2000), static_cast<_Float16>(2121), - static_cast<_Float16>(2244), static_cast<_Float16>(2369), - static_cast<_Float16>(2496), static_cast<_Float16>(2625), - static_cast<_Float16>(2756), static_cast<_Float16>(2889), - static_cast<_Float16>(3024), static_cast<_Float16>(3161), - static_cast<_Float16>(3300), static_cast<_Float16>(3441), - static_cast<_Float16>(3584), static_cast<_Float16>(3729), - static_cast<_Float16>(3876), static_cast<_Float16>(4025), - static_cast<_Float16>(4176), static_cast<_Float16>(4329), - static_cast<_Float16>(4484), static_cast<_Float16>(4641)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(4), static_cast<_FP16>(9), + static_cast<_FP16>(16), static_cast<_FP16>(25), + static_cast<_FP16>(36), static_cast<_FP16>(49), + static_cast<_FP16>(64), static_cast<_FP16>(81), + static_cast<_FP16>(100), static_cast<_FP16>(121), + static_cast<_FP16>(144), static_cast<_FP16>(169), + static_cast<_FP16>(196), static_cast<_FP16>(225), + static_cast<_FP16>(256), static_cast<_FP16>(289), + static_cast<_FP16>(324), static_cast<_FP16>(361), + static_cast<_FP16>(400), static_cast<_FP16>(441), + static_cast<_FP16>(484), static_cast<_FP16>(529), + static_cast<_FP16>(576), static_cast<_FP16>(625), + static_cast<_FP16>(676), static_cast<_FP16>(729), + static_cast<_FP16>(784), static_cast<_FP16>(841), + static_cast<_FP16>(900), static_cast<_FP16>(961), + static_cast<_FP16>(1024), static_cast<_FP16>(1089), + static_cast<_FP16>(1156), static_cast<_FP16>(1225), + static_cast<_FP16>(1296), static_cast<_FP16>(1369), + static_cast<_FP16>(1444), static_cast<_FP16>(1521), + static_cast<_FP16>(0), static_cast<_FP16>(41), + static_cast<_FP16>(84), static_cast<_FP16>(129), + static_cast<_FP16>(176), static_cast<_FP16>(225), + static_cast<_FP16>(276), static_cast<_FP16>(329), + static_cast<_FP16>(384), static_cast<_FP16>(441), + static_cast<_FP16>(500), static_cast<_FP16>(561), + static_cast<_FP16>(624), static_cast<_FP16>(689), + static_cast<_FP16>(756), static_cast<_FP16>(825), + static_cast<_FP16>(896), static_cast<_FP16>(969), + static_cast<_FP16>(1044), static_cast<_FP16>(1121), + static_cast<_FP16>(1200), static_cast<_FP16>(1281), + static_cast<_FP16>(1364), static_cast<_FP16>(1449), + static_cast<_FP16>(1536), static_cast<_FP16>(1625), + static_cast<_FP16>(1716), static_cast<_FP16>(1809), + static_cast<_FP16>(1904), static_cast<_FP16>(2001), + static_cast<_FP16>(2100), static_cast<_FP16>(2201), + static_cast<_FP16>(2304), static_cast<_FP16>(2409), + static_cast<_FP16>(2516), static_cast<_FP16>(2625), + static_cast<_FP16>(2736), static_cast<_FP16>(2849), + static_cast<_FP16>(2964), static_cast<_FP16>(3081), + static_cast<_FP16>(0), static_cast<_FP16>(81), + static_cast<_FP16>(164), static_cast<_FP16>(249), + static_cast<_FP16>(336), static_cast<_FP16>(425), + static_cast<_FP16>(516), static_cast<_FP16>(609), + static_cast<_FP16>(704), static_cast<_FP16>(801), + static_cast<_FP16>(900), static_cast<_FP16>(1001), + static_cast<_FP16>(1104), static_cast<_FP16>(1209), + static_cast<_FP16>(1316), static_cast<_FP16>(1425), + static_cast<_FP16>(1536), static_cast<_FP16>(1649), + static_cast<_FP16>(1764), static_cast<_FP16>(1881), + static_cast<_FP16>(2000), static_cast<_FP16>(2121), + static_cast<_FP16>(2244), static_cast<_FP16>(2369), + static_cast<_FP16>(2496), static_cast<_FP16>(2625), + static_cast<_FP16>(2756), static_cast<_FP16>(2889), + static_cast<_FP16>(3024), static_cast<_FP16>(3161), + static_cast<_FP16>(3300), static_cast<_FP16>(3441), + static_cast<_FP16>(3584), static_cast<_FP16>(3729), + static_cast<_FP16>(3876), static_cast<_FP16>(4025), + static_cast<_FP16>(4176), static_cast<_FP16>(4329), + static_cast<_FP16>(4484), static_cast<_FP16>(4641)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -249,67 +248,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(4), static_cast<_Float16>(9), - static_cast<_Float16>(16), static_cast<_Float16>(25), - static_cast<_Float16>(36), static_cast<_Float16>(49), - static_cast<_Float16>(64), static_cast<_Float16>(81), - static_cast<_Float16>(100), static_cast<_Float16>(121), - static_cast<_Float16>(144), static_cast<_Float16>(169), - static_cast<_Float16>(196), static_cast<_Float16>(225), - static_cast<_Float16>(256), static_cast<_Float16>(289), - static_cast<_Float16>(324), static_cast<_Float16>(361), - static_cast<_Float16>(0), static_cast<_Float16>(21), - static_cast<_Float16>(44), static_cast<_Float16>(69), - static_cast<_Float16>(96), static_cast<_Float16>(125), - static_cast<_Float16>(156), static_cast<_Float16>(189), - static_cast<_Float16>(224), static_cast<_Float16>(261), - static_cast<_Float16>(300), static_cast<_Float16>(341), - static_cast<_Float16>(384), static_cast<_Float16>(429), - static_cast<_Float16>(476), static_cast<_Float16>(525), - static_cast<_Float16>(576), static_cast<_Float16>(629), - static_cast<_Float16>(684), static_cast<_Float16>(741), - static_cast<_Float16>(800), static_cast<_Float16>(861), - static_cast<_Float16>(924), static_cast<_Float16>(989), - static_cast<_Float16>(1056), static_cast<_Float16>(1125), - static_cast<_Float16>(1196), static_cast<_Float16>(1269), - static_cast<_Float16>(1344), static_cast<_Float16>(1421), - static_cast<_Float16>(1500), static_cast<_Float16>(1581), - static_cast<_Float16>(1664), static_cast<_Float16>(1749), - static_cast<_Float16>(1836), static_cast<_Float16>(1925), - static_cast<_Float16>(2016), static_cast<_Float16>(2109), - static_cast<_Float16>(2204), static_cast<_Float16>(2301), - static_cast<_Float16>(1200), static_cast<_Float16>(1281), - static_cast<_Float16>(1364), static_cast<_Float16>(1449), - static_cast<_Float16>(1536), static_cast<_Float16>(1625), - static_cast<_Float16>(1716), static_cast<_Float16>(1809), - static_cast<_Float16>(1904), static_cast<_Float16>(2001), - static_cast<_Float16>(2100), static_cast<_Float16>(2201), - static_cast<_Float16>(2304), static_cast<_Float16>(2409), - static_cast<_Float16>(2516), static_cast<_Float16>(2625), - static_cast<_Float16>(2736), static_cast<_Float16>(2849), - static_cast<_Float16>(2964), static_cast<_Float16>(3081), - static_cast<_Float16>(3200), static_cast<_Float16>(3321), - static_cast<_Float16>(3444), static_cast<_Float16>(3569), - static_cast<_Float16>(3696), static_cast<_Float16>(3825), - static_cast<_Float16>(3956), static_cast<_Float16>(4089), - static_cast<_Float16>(4224), static_cast<_Float16>(4361), - static_cast<_Float16>(4500), static_cast<_Float16>(4641), - static_cast<_Float16>(4784), static_cast<_Float16>(4929), - static_cast<_Float16>(5076), static_cast<_Float16>(5225), - static_cast<_Float16>(5376), static_cast<_Float16>(5529), - static_cast<_Float16>(5684), static_cast<_Float16>(5841), - static_cast<_Float16>(4000), static_cast<_Float16>(4141), - static_cast<_Float16>(4284), static_cast<_Float16>(4429), - static_cast<_Float16>(4576), static_cast<_Float16>(4725), - static_cast<_Float16>(4876), static_cast<_Float16>(5029), - static_cast<_Float16>(5184), static_cast<_Float16>(5341), - static_cast<_Float16>(5500), static_cast<_Float16>(5661), - static_cast<_Float16>(5824), static_cast<_Float16>(5989), - static_cast<_Float16>(6156), static_cast<_Float16>(6325), - static_cast<_Float16>(6496), static_cast<_Float16>(6669), - static_cast<_Float16>(6844), static_cast<_Float16>(7021)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(4), static_cast<_FP16>(9), + static_cast<_FP16>(16), static_cast<_FP16>(25), + static_cast<_FP16>(36), static_cast<_FP16>(49), + static_cast<_FP16>(64), static_cast<_FP16>(81), + static_cast<_FP16>(100), static_cast<_FP16>(121), + static_cast<_FP16>(144), static_cast<_FP16>(169), + static_cast<_FP16>(196), static_cast<_FP16>(225), + static_cast<_FP16>(256), static_cast<_FP16>(289), + static_cast<_FP16>(324), static_cast<_FP16>(361), + static_cast<_FP16>(0), static_cast<_FP16>(21), + static_cast<_FP16>(44), static_cast<_FP16>(69), + static_cast<_FP16>(96), static_cast<_FP16>(125), + static_cast<_FP16>(156), static_cast<_FP16>(189), + static_cast<_FP16>(224), static_cast<_FP16>(261), + static_cast<_FP16>(300), static_cast<_FP16>(341), + static_cast<_FP16>(384), static_cast<_FP16>(429), + static_cast<_FP16>(476), static_cast<_FP16>(525), + static_cast<_FP16>(576), static_cast<_FP16>(629), + static_cast<_FP16>(684), static_cast<_FP16>(741), + static_cast<_FP16>(800), static_cast<_FP16>(861), + static_cast<_FP16>(924), static_cast<_FP16>(989), + static_cast<_FP16>(1056), static_cast<_FP16>(1125), + static_cast<_FP16>(1196), static_cast<_FP16>(1269), + static_cast<_FP16>(1344), static_cast<_FP16>(1421), + static_cast<_FP16>(1500), static_cast<_FP16>(1581), + static_cast<_FP16>(1664), static_cast<_FP16>(1749), + static_cast<_FP16>(1836), static_cast<_FP16>(1925), + static_cast<_FP16>(2016), static_cast<_FP16>(2109), + static_cast<_FP16>(2204), static_cast<_FP16>(2301), + static_cast<_FP16>(1200), static_cast<_FP16>(1281), + static_cast<_FP16>(1364), static_cast<_FP16>(1449), + static_cast<_FP16>(1536), static_cast<_FP16>(1625), + static_cast<_FP16>(1716), static_cast<_FP16>(1809), + static_cast<_FP16>(1904), static_cast<_FP16>(2001), + static_cast<_FP16>(2100), static_cast<_FP16>(2201), + static_cast<_FP16>(2304), static_cast<_FP16>(2409), + static_cast<_FP16>(2516), static_cast<_FP16>(2625), + static_cast<_FP16>(2736), static_cast<_FP16>(2849), + static_cast<_FP16>(2964), static_cast<_FP16>(3081), + static_cast<_FP16>(3200), static_cast<_FP16>(3321), + static_cast<_FP16>(3444), static_cast<_FP16>(3569), + static_cast<_FP16>(3696), static_cast<_FP16>(3825), + static_cast<_FP16>(3956), static_cast<_FP16>(4089), + static_cast<_FP16>(4224), static_cast<_FP16>(4361), + static_cast<_FP16>(4500), static_cast<_FP16>(4641), + static_cast<_FP16>(4784), static_cast<_FP16>(4929), + static_cast<_FP16>(5076), static_cast<_FP16>(5225), + static_cast<_FP16>(5376), static_cast<_FP16>(5529), + static_cast<_FP16>(5684), static_cast<_FP16>(5841), + static_cast<_FP16>(4000), static_cast<_FP16>(4141), + static_cast<_FP16>(4284), static_cast<_FP16>(4429), + static_cast<_FP16>(4576), static_cast<_FP16>(4725), + static_cast<_FP16>(4876), static_cast<_FP16>(5029), + static_cast<_FP16>(5184), static_cast<_FP16>(5341), + static_cast<_FP16>(5500), static_cast<_FP16>(5661), + static_cast<_FP16>(5824), static_cast<_FP16>(5989), + static_cast<_FP16>(6156), static_cast<_FP16>(6325), + static_cast<_FP16>(6496), static_cast<_FP16>(6669), + static_cast<_FP16>(6844), static_cast<_FP16>(7021)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -322,67 +320,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 2, 4, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(5), - static_cast<_Float16>(6), static_cast<_Float16>(7), - static_cast<_Float16>(8), static_cast<_Float16>(9), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(45), - static_cast<_Float16>(48), static_cast<_Float16>(51), - static_cast<_Float16>(54), static_cast<_Float16>(57), - static_cast<_Float16>(80), static_cast<_Float16>(84), - static_cast<_Float16>(88), static_cast<_Float16>(92), - static_cast<_Float16>(96), static_cast<_Float16>(125), - static_cast<_Float16>(130), static_cast<_Float16>(135), - static_cast<_Float16>(140), static_cast<_Float16>(145), - static_cast<_Float16>(180), static_cast<_Float16>(186), - static_cast<_Float16>(192), static_cast<_Float16>(198), - static_cast<_Float16>(204), static_cast<_Float16>(245), - static_cast<_Float16>(252), static_cast<_Float16>(259), - static_cast<_Float16>(266), static_cast<_Float16>(273), - static_cast<_Float16>(320), static_cast<_Float16>(328), - static_cast<_Float16>(336), static_cast<_Float16>(344), - static_cast<_Float16>(352), static_cast<_Float16>(405), - static_cast<_Float16>(414), static_cast<_Float16>(423), - static_cast<_Float16>(432), static_cast<_Float16>(441), - static_cast<_Float16>(500), static_cast<_Float16>(510), - static_cast<_Float16>(520), static_cast<_Float16>(530), - static_cast<_Float16>(540), static_cast<_Float16>(605), - static_cast<_Float16>(616), static_cast<_Float16>(627), - static_cast<_Float16>(638), static_cast<_Float16>(649), - static_cast<_Float16>(720), static_cast<_Float16>(732), - static_cast<_Float16>(744), static_cast<_Float16>(756), - static_cast<_Float16>(768), static_cast<_Float16>(845), - static_cast<_Float16>(858), static_cast<_Float16>(871), - static_cast<_Float16>(884), static_cast<_Float16>(897), - static_cast<_Float16>(980), static_cast<_Float16>(994), - static_cast<_Float16>(1008), static_cast<_Float16>(1022), - static_cast<_Float16>(1036), static_cast<_Float16>(1125), - static_cast<_Float16>(1140), static_cast<_Float16>(1155), - static_cast<_Float16>(1170), static_cast<_Float16>(1185), - static_cast<_Float16>(1280), static_cast<_Float16>(1296), - static_cast<_Float16>(1312), static_cast<_Float16>(1328), - static_cast<_Float16>(1344), static_cast<_Float16>(1445), - static_cast<_Float16>(1462), static_cast<_Float16>(1479), - static_cast<_Float16>(1496), static_cast<_Float16>(1513), - static_cast<_Float16>(1620), static_cast<_Float16>(1638), - static_cast<_Float16>(1656), static_cast<_Float16>(1674), - static_cast<_Float16>(1692), static_cast<_Float16>(1805), - static_cast<_Float16>(1824), static_cast<_Float16>(1843), - static_cast<_Float16>(1862), static_cast<_Float16>(1881), - static_cast<_Float16>(2000), static_cast<_Float16>(2020), - static_cast<_Float16>(2040), static_cast<_Float16>(2060), - static_cast<_Float16>(2080), static_cast<_Float16>(2205), - static_cast<_Float16>(2226), static_cast<_Float16>(2247), - static_cast<_Float16>(2268), static_cast<_Float16>(2289), - static_cast<_Float16>(2420), static_cast<_Float16>(2442), - static_cast<_Float16>(2464), static_cast<_Float16>(2486), - static_cast<_Float16>(2508), static_cast<_Float16>(2645), - static_cast<_Float16>(2668), static_cast<_Float16>(2691), - static_cast<_Float16>(2714), static_cast<_Float16>(2737)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(5), + static_cast<_FP16>(6), static_cast<_FP16>(7), + static_cast<_FP16>(8), static_cast<_FP16>(9), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(45), + static_cast<_FP16>(48), static_cast<_FP16>(51), + static_cast<_FP16>(54), static_cast<_FP16>(57), + static_cast<_FP16>(80), static_cast<_FP16>(84), + static_cast<_FP16>(88), static_cast<_FP16>(92), + static_cast<_FP16>(96), static_cast<_FP16>(125), + static_cast<_FP16>(130), static_cast<_FP16>(135), + static_cast<_FP16>(140), static_cast<_FP16>(145), + static_cast<_FP16>(180), static_cast<_FP16>(186), + static_cast<_FP16>(192), static_cast<_FP16>(198), + static_cast<_FP16>(204), static_cast<_FP16>(245), + static_cast<_FP16>(252), static_cast<_FP16>(259), + static_cast<_FP16>(266), static_cast<_FP16>(273), + static_cast<_FP16>(320), static_cast<_FP16>(328), + static_cast<_FP16>(336), static_cast<_FP16>(344), + static_cast<_FP16>(352), static_cast<_FP16>(405), + static_cast<_FP16>(414), static_cast<_FP16>(423), + static_cast<_FP16>(432), static_cast<_FP16>(441), + static_cast<_FP16>(500), static_cast<_FP16>(510), + static_cast<_FP16>(520), static_cast<_FP16>(530), + static_cast<_FP16>(540), static_cast<_FP16>(605), + static_cast<_FP16>(616), static_cast<_FP16>(627), + static_cast<_FP16>(638), static_cast<_FP16>(649), + static_cast<_FP16>(720), static_cast<_FP16>(732), + static_cast<_FP16>(744), static_cast<_FP16>(756), + static_cast<_FP16>(768), static_cast<_FP16>(845), + static_cast<_FP16>(858), static_cast<_FP16>(871), + static_cast<_FP16>(884), static_cast<_FP16>(897), + static_cast<_FP16>(980), static_cast<_FP16>(994), + static_cast<_FP16>(1008), static_cast<_FP16>(1022), + static_cast<_FP16>(1036), static_cast<_FP16>(1125), + static_cast<_FP16>(1140), static_cast<_FP16>(1155), + static_cast<_FP16>(1170), static_cast<_FP16>(1185), + static_cast<_FP16>(1280), static_cast<_FP16>(1296), + static_cast<_FP16>(1312), static_cast<_FP16>(1328), + static_cast<_FP16>(1344), static_cast<_FP16>(1445), + static_cast<_FP16>(1462), static_cast<_FP16>(1479), + static_cast<_FP16>(1496), static_cast<_FP16>(1513), + static_cast<_FP16>(1620), static_cast<_FP16>(1638), + static_cast<_FP16>(1656), static_cast<_FP16>(1674), + static_cast<_FP16>(1692), static_cast<_FP16>(1805), + static_cast<_FP16>(1824), static_cast<_FP16>(1843), + static_cast<_FP16>(1862), static_cast<_FP16>(1881), + static_cast<_FP16>(2000), static_cast<_FP16>(2020), + static_cast<_FP16>(2040), static_cast<_FP16>(2060), + static_cast<_FP16>(2080), static_cast<_FP16>(2205), + static_cast<_FP16>(2226), static_cast<_FP16>(2247), + static_cast<_FP16>(2268), static_cast<_FP16>(2289), + static_cast<_FP16>(2420), static_cast<_FP16>(2442), + static_cast<_FP16>(2464), static_cast<_FP16>(2486), + static_cast<_FP16>(2508), static_cast<_FP16>(2645), + static_cast<_FP16>(2668), static_cast<_FP16>(2691), + static_cast<_FP16>(2714), static_cast<_FP16>(2737)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -395,67 +392,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(4), static_cast<_Float16>(9), - static_cast<_Float16>(16), static_cast<_Float16>(0), - static_cast<_Float16>(6), static_cast<_Float16>(14), - static_cast<_Float16>(24), static_cast<_Float16>(36), - static_cast<_Float16>(0), static_cast<_Float16>(11), - static_cast<_Float16>(24), static_cast<_Float16>(39), - static_cast<_Float16>(56), static_cast<_Float16>(0), - static_cast<_Float16>(16), static_cast<_Float16>(34), - static_cast<_Float16>(54), static_cast<_Float16>(76), - static_cast<_Float16>(0), static_cast<_Float16>(21), - static_cast<_Float16>(44), static_cast<_Float16>(69), - static_cast<_Float16>(96), static_cast<_Float16>(0), - static_cast<_Float16>(26), static_cast<_Float16>(54), - static_cast<_Float16>(84), static_cast<_Float16>(116), - static_cast<_Float16>(0), static_cast<_Float16>(31), - static_cast<_Float16>(64), static_cast<_Float16>(99), - static_cast<_Float16>(136), static_cast<_Float16>(0), - static_cast<_Float16>(36), static_cast<_Float16>(74), - static_cast<_Float16>(114), static_cast<_Float16>(156), - static_cast<_Float16>(200), static_cast<_Float16>(246), - static_cast<_Float16>(294), static_cast<_Float16>(344), - static_cast<_Float16>(396), static_cast<_Float16>(225), - static_cast<_Float16>(276), static_cast<_Float16>(329), - static_cast<_Float16>(384), static_cast<_Float16>(441), - static_cast<_Float16>(250), static_cast<_Float16>(306), - static_cast<_Float16>(364), static_cast<_Float16>(424), - static_cast<_Float16>(486), static_cast<_Float16>(275), - static_cast<_Float16>(336), static_cast<_Float16>(399), - static_cast<_Float16>(464), static_cast<_Float16>(531), - static_cast<_Float16>(300), static_cast<_Float16>(366), - static_cast<_Float16>(434), static_cast<_Float16>(504), - static_cast<_Float16>(576), static_cast<_Float16>(325), - static_cast<_Float16>(396), static_cast<_Float16>(469), - static_cast<_Float16>(544), static_cast<_Float16>(621), - static_cast<_Float16>(350), static_cast<_Float16>(426), - static_cast<_Float16>(504), static_cast<_Float16>(584), - static_cast<_Float16>(666), static_cast<_Float16>(375), - static_cast<_Float16>(456), static_cast<_Float16>(539), - static_cast<_Float16>(624), static_cast<_Float16>(711), - static_cast<_Float16>(800), static_cast<_Float16>(891), - static_cast<_Float16>(984), static_cast<_Float16>(1079), - static_cast<_Float16>(1176), static_cast<_Float16>(850), - static_cast<_Float16>(946), static_cast<_Float16>(1044), - static_cast<_Float16>(1144), static_cast<_Float16>(1246), - static_cast<_Float16>(900), static_cast<_Float16>(1001), - static_cast<_Float16>(1104), static_cast<_Float16>(1209), - static_cast<_Float16>(1316), static_cast<_Float16>(950), - static_cast<_Float16>(1056), static_cast<_Float16>(1164), - static_cast<_Float16>(1274), static_cast<_Float16>(1386), - static_cast<_Float16>(1000), static_cast<_Float16>(1111), - static_cast<_Float16>(1224), static_cast<_Float16>(1339), - static_cast<_Float16>(1456), static_cast<_Float16>(1050), - static_cast<_Float16>(1166), static_cast<_Float16>(1284), - static_cast<_Float16>(1404), static_cast<_Float16>(1526), - static_cast<_Float16>(1100), static_cast<_Float16>(1221), - static_cast<_Float16>(1344), static_cast<_Float16>(1469), - static_cast<_Float16>(1596), static_cast<_Float16>(1150), - static_cast<_Float16>(1276), static_cast<_Float16>(1404), - static_cast<_Float16>(1534), static_cast<_Float16>(1666)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(4), static_cast<_FP16>(9), + static_cast<_FP16>(16), static_cast<_FP16>(0), + static_cast<_FP16>(6), static_cast<_FP16>(14), + static_cast<_FP16>(24), static_cast<_FP16>(36), + static_cast<_FP16>(0), static_cast<_FP16>(11), + static_cast<_FP16>(24), static_cast<_FP16>(39), + static_cast<_FP16>(56), static_cast<_FP16>(0), + static_cast<_FP16>(16), static_cast<_FP16>(34), + static_cast<_FP16>(54), static_cast<_FP16>(76), + static_cast<_FP16>(0), static_cast<_FP16>(21), + static_cast<_FP16>(44), static_cast<_FP16>(69), + static_cast<_FP16>(96), static_cast<_FP16>(0), + static_cast<_FP16>(26), static_cast<_FP16>(54), + static_cast<_FP16>(84), static_cast<_FP16>(116), + static_cast<_FP16>(0), static_cast<_FP16>(31), + static_cast<_FP16>(64), static_cast<_FP16>(99), + static_cast<_FP16>(136), static_cast<_FP16>(0), + static_cast<_FP16>(36), static_cast<_FP16>(74), + static_cast<_FP16>(114), static_cast<_FP16>(156), + static_cast<_FP16>(200), static_cast<_FP16>(246), + static_cast<_FP16>(294), static_cast<_FP16>(344), + static_cast<_FP16>(396), static_cast<_FP16>(225), + static_cast<_FP16>(276), static_cast<_FP16>(329), + static_cast<_FP16>(384), static_cast<_FP16>(441), + static_cast<_FP16>(250), static_cast<_FP16>(306), + static_cast<_FP16>(364), static_cast<_FP16>(424), + static_cast<_FP16>(486), static_cast<_FP16>(275), + static_cast<_FP16>(336), static_cast<_FP16>(399), + static_cast<_FP16>(464), static_cast<_FP16>(531), + static_cast<_FP16>(300), static_cast<_FP16>(366), + static_cast<_FP16>(434), static_cast<_FP16>(504), + static_cast<_FP16>(576), static_cast<_FP16>(325), + static_cast<_FP16>(396), static_cast<_FP16>(469), + static_cast<_FP16>(544), static_cast<_FP16>(621), + static_cast<_FP16>(350), static_cast<_FP16>(426), + static_cast<_FP16>(504), static_cast<_FP16>(584), + static_cast<_FP16>(666), static_cast<_FP16>(375), + static_cast<_FP16>(456), static_cast<_FP16>(539), + static_cast<_FP16>(624), static_cast<_FP16>(711), + static_cast<_FP16>(800), static_cast<_FP16>(891), + static_cast<_FP16>(984), static_cast<_FP16>(1079), + static_cast<_FP16>(1176), static_cast<_FP16>(850), + static_cast<_FP16>(946), static_cast<_FP16>(1044), + static_cast<_FP16>(1144), static_cast<_FP16>(1246), + static_cast<_FP16>(900), static_cast<_FP16>(1001), + static_cast<_FP16>(1104), static_cast<_FP16>(1209), + static_cast<_FP16>(1316), static_cast<_FP16>(950), + static_cast<_FP16>(1056), static_cast<_FP16>(1164), + static_cast<_FP16>(1274), static_cast<_FP16>(1386), + static_cast<_FP16>(1000), static_cast<_FP16>(1111), + static_cast<_FP16>(1224), static_cast<_FP16>(1339), + static_cast<_FP16>(1456), static_cast<_FP16>(1050), + static_cast<_FP16>(1166), static_cast<_FP16>(1284), + static_cast<_FP16>(1404), static_cast<_FP16>(1526), + static_cast<_FP16>(1100), static_cast<_FP16>(1221), + static_cast<_FP16>(1344), static_cast<_FP16>(1469), + static_cast<_FP16>(1596), static_cast<_FP16>(1150), + static_cast<_FP16>(1276), static_cast<_FP16>(1404), + static_cast<_FP16>(1534), static_cast<_FP16>(1666)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -468,67 +464,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 2, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(4), static_cast<_Float16>(9), - static_cast<_Float16>(16), static_cast<_Float16>(0), - static_cast<_Float16>(6), static_cast<_Float16>(14), - static_cast<_Float16>(24), static_cast<_Float16>(36), - static_cast<_Float16>(0), static_cast<_Float16>(11), - static_cast<_Float16>(24), static_cast<_Float16>(39), - static_cast<_Float16>(56), static_cast<_Float16>(0), - static_cast<_Float16>(16), static_cast<_Float16>(34), - static_cast<_Float16>(54), static_cast<_Float16>(76), - static_cast<_Float16>(100), static_cast<_Float16>(126), - static_cast<_Float16>(154), static_cast<_Float16>(184), - static_cast<_Float16>(216), static_cast<_Float16>(125), - static_cast<_Float16>(156), static_cast<_Float16>(189), - static_cast<_Float16>(224), static_cast<_Float16>(261), - static_cast<_Float16>(150), static_cast<_Float16>(186), - static_cast<_Float16>(224), static_cast<_Float16>(264), - static_cast<_Float16>(306), static_cast<_Float16>(175), - static_cast<_Float16>(216), static_cast<_Float16>(259), - static_cast<_Float16>(304), static_cast<_Float16>(351), - static_cast<_Float16>(0), static_cast<_Float16>(41), - static_cast<_Float16>(84), static_cast<_Float16>(129), - static_cast<_Float16>(176), static_cast<_Float16>(0), - static_cast<_Float16>(46), static_cast<_Float16>(94), - static_cast<_Float16>(144), static_cast<_Float16>(196), - static_cast<_Float16>(0), static_cast<_Float16>(51), - static_cast<_Float16>(104), static_cast<_Float16>(159), - static_cast<_Float16>(216), static_cast<_Float16>(0), - static_cast<_Float16>(56), static_cast<_Float16>(114), - static_cast<_Float16>(174), static_cast<_Float16>(236), - static_cast<_Float16>(300), static_cast<_Float16>(366), - static_cast<_Float16>(434), static_cast<_Float16>(504), - static_cast<_Float16>(576), static_cast<_Float16>(325), - static_cast<_Float16>(396), static_cast<_Float16>(469), - static_cast<_Float16>(544), static_cast<_Float16>(621), - static_cast<_Float16>(350), static_cast<_Float16>(426), - static_cast<_Float16>(504), static_cast<_Float16>(584), - static_cast<_Float16>(666), static_cast<_Float16>(375), - static_cast<_Float16>(456), static_cast<_Float16>(539), - static_cast<_Float16>(624), static_cast<_Float16>(711), - static_cast<_Float16>(0), static_cast<_Float16>(81), - static_cast<_Float16>(164), static_cast<_Float16>(249), - static_cast<_Float16>(336), static_cast<_Float16>(0), - static_cast<_Float16>(86), static_cast<_Float16>(174), - static_cast<_Float16>(264), static_cast<_Float16>(356), - static_cast<_Float16>(0), static_cast<_Float16>(91), - static_cast<_Float16>(184), static_cast<_Float16>(279), - static_cast<_Float16>(376), static_cast<_Float16>(0), - static_cast<_Float16>(96), static_cast<_Float16>(194), - static_cast<_Float16>(294), static_cast<_Float16>(396), - static_cast<_Float16>(500), static_cast<_Float16>(606), - static_cast<_Float16>(714), static_cast<_Float16>(824), - static_cast<_Float16>(936), static_cast<_Float16>(525), - static_cast<_Float16>(636), static_cast<_Float16>(749), - static_cast<_Float16>(864), static_cast<_Float16>(981), - static_cast<_Float16>(550), static_cast<_Float16>(666), - static_cast<_Float16>(784), static_cast<_Float16>(904), - static_cast<_Float16>(1026), static_cast<_Float16>(575), - static_cast<_Float16>(696), static_cast<_Float16>(819), - static_cast<_Float16>(944), static_cast<_Float16>(1071)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(4), static_cast<_FP16>(9), + static_cast<_FP16>(16), static_cast<_FP16>(0), + static_cast<_FP16>(6), static_cast<_FP16>(14), + static_cast<_FP16>(24), static_cast<_FP16>(36), + static_cast<_FP16>(0), static_cast<_FP16>(11), + static_cast<_FP16>(24), static_cast<_FP16>(39), + static_cast<_FP16>(56), static_cast<_FP16>(0), + static_cast<_FP16>(16), static_cast<_FP16>(34), + static_cast<_FP16>(54), static_cast<_FP16>(76), + static_cast<_FP16>(100), static_cast<_FP16>(126), + static_cast<_FP16>(154), static_cast<_FP16>(184), + static_cast<_FP16>(216), static_cast<_FP16>(125), + static_cast<_FP16>(156), static_cast<_FP16>(189), + static_cast<_FP16>(224), static_cast<_FP16>(261), + static_cast<_FP16>(150), static_cast<_FP16>(186), + static_cast<_FP16>(224), static_cast<_FP16>(264), + static_cast<_FP16>(306), static_cast<_FP16>(175), + static_cast<_FP16>(216), static_cast<_FP16>(259), + static_cast<_FP16>(304), static_cast<_FP16>(351), + static_cast<_FP16>(0), static_cast<_FP16>(41), + static_cast<_FP16>(84), static_cast<_FP16>(129), + static_cast<_FP16>(176), static_cast<_FP16>(0), + static_cast<_FP16>(46), static_cast<_FP16>(94), + static_cast<_FP16>(144), static_cast<_FP16>(196), + static_cast<_FP16>(0), static_cast<_FP16>(51), + static_cast<_FP16>(104), static_cast<_FP16>(159), + static_cast<_FP16>(216), static_cast<_FP16>(0), + static_cast<_FP16>(56), static_cast<_FP16>(114), + static_cast<_FP16>(174), static_cast<_FP16>(236), + static_cast<_FP16>(300), static_cast<_FP16>(366), + static_cast<_FP16>(434), static_cast<_FP16>(504), + static_cast<_FP16>(576), static_cast<_FP16>(325), + static_cast<_FP16>(396), static_cast<_FP16>(469), + static_cast<_FP16>(544), static_cast<_FP16>(621), + static_cast<_FP16>(350), static_cast<_FP16>(426), + static_cast<_FP16>(504), static_cast<_FP16>(584), + static_cast<_FP16>(666), static_cast<_FP16>(375), + static_cast<_FP16>(456), static_cast<_FP16>(539), + static_cast<_FP16>(624), static_cast<_FP16>(711), + static_cast<_FP16>(0), static_cast<_FP16>(81), + static_cast<_FP16>(164), static_cast<_FP16>(249), + static_cast<_FP16>(336), static_cast<_FP16>(0), + static_cast<_FP16>(86), static_cast<_FP16>(174), + static_cast<_FP16>(264), static_cast<_FP16>(356), + static_cast<_FP16>(0), static_cast<_FP16>(91), + static_cast<_FP16>(184), static_cast<_FP16>(279), + static_cast<_FP16>(376), static_cast<_FP16>(0), + static_cast<_FP16>(96), static_cast<_FP16>(194), + static_cast<_FP16>(294), static_cast<_FP16>(396), + static_cast<_FP16>(500), static_cast<_FP16>(606), + static_cast<_FP16>(714), static_cast<_FP16>(824), + static_cast<_FP16>(936), static_cast<_FP16>(525), + static_cast<_FP16>(636), static_cast<_FP16>(749), + static_cast<_FP16>(864), static_cast<_FP16>(981), + static_cast<_FP16>(550), static_cast<_FP16>(666), + static_cast<_FP16>(784), static_cast<_FP16>(904), + static_cast<_FP16>(1026), static_cast<_FP16>(575), + static_cast<_FP16>(696), static_cast<_FP16>(819), + static_cast<_FP16>(944), static_cast<_FP16>(1071)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -541,67 +536,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 4, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(5), - static_cast<_Float16>(6), static_cast<_Float16>(7), - static_cast<_Float16>(8), static_cast<_Float16>(9), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(45), - static_cast<_Float16>(48), static_cast<_Float16>(51), - static_cast<_Float16>(54), static_cast<_Float16>(57), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(25), - static_cast<_Float16>(26), static_cast<_Float16>(27), - static_cast<_Float16>(28), static_cast<_Float16>(29), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(68), static_cast<_Float16>(105), - static_cast<_Float16>(108), static_cast<_Float16>(111), - static_cast<_Float16>(114), static_cast<_Float16>(117), - static_cast<_Float16>(160), static_cast<_Float16>(164), - static_cast<_Float16>(168), static_cast<_Float16>(172), - static_cast<_Float16>(176), static_cast<_Float16>(225), - static_cast<_Float16>(230), static_cast<_Float16>(235), - static_cast<_Float16>(240), static_cast<_Float16>(245), - static_cast<_Float16>(300), static_cast<_Float16>(306), - static_cast<_Float16>(312), static_cast<_Float16>(318), - static_cast<_Float16>(324), static_cast<_Float16>(385), - static_cast<_Float16>(392), static_cast<_Float16>(399), - static_cast<_Float16>(406), static_cast<_Float16>(413), - static_cast<_Float16>(240), static_cast<_Float16>(244), - static_cast<_Float16>(248), static_cast<_Float16>(252), - static_cast<_Float16>(256), static_cast<_Float16>(325), - static_cast<_Float16>(330), static_cast<_Float16>(335), - static_cast<_Float16>(340), static_cast<_Float16>(345), - static_cast<_Float16>(420), static_cast<_Float16>(426), - static_cast<_Float16>(432), static_cast<_Float16>(438), - static_cast<_Float16>(444), static_cast<_Float16>(525), - static_cast<_Float16>(532), static_cast<_Float16>(539), - static_cast<_Float16>(546), static_cast<_Float16>(553), - static_cast<_Float16>(640), static_cast<_Float16>(648), - static_cast<_Float16>(656), static_cast<_Float16>(664), - static_cast<_Float16>(672), static_cast<_Float16>(765), - static_cast<_Float16>(774), static_cast<_Float16>(783), - static_cast<_Float16>(792), static_cast<_Float16>(801), - static_cast<_Float16>(900), static_cast<_Float16>(910), - static_cast<_Float16>(920), static_cast<_Float16>(930), - static_cast<_Float16>(940), static_cast<_Float16>(1045), - static_cast<_Float16>(1056), static_cast<_Float16>(1067), - static_cast<_Float16>(1078), static_cast<_Float16>(1089), - static_cast<_Float16>(800), static_cast<_Float16>(808), - static_cast<_Float16>(816), static_cast<_Float16>(824), - static_cast<_Float16>(832), static_cast<_Float16>(945), - static_cast<_Float16>(954), static_cast<_Float16>(963), - static_cast<_Float16>(972), static_cast<_Float16>(981), - static_cast<_Float16>(1100), static_cast<_Float16>(1110), - static_cast<_Float16>(1120), static_cast<_Float16>(1130), - static_cast<_Float16>(1140), static_cast<_Float16>(1265), - static_cast<_Float16>(1276), static_cast<_Float16>(1287), - static_cast<_Float16>(1298), static_cast<_Float16>(1309)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(5), + static_cast<_FP16>(6), static_cast<_FP16>(7), + static_cast<_FP16>(8), static_cast<_FP16>(9), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(45), + static_cast<_FP16>(48), static_cast<_FP16>(51), + static_cast<_FP16>(54), static_cast<_FP16>(57), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(25), + static_cast<_FP16>(26), static_cast<_FP16>(27), + static_cast<_FP16>(28), static_cast<_FP16>(29), + static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(64), static_cast<_FP16>(66), + static_cast<_FP16>(68), static_cast<_FP16>(105), + static_cast<_FP16>(108), static_cast<_FP16>(111), + static_cast<_FP16>(114), static_cast<_FP16>(117), + static_cast<_FP16>(160), static_cast<_FP16>(164), + static_cast<_FP16>(168), static_cast<_FP16>(172), + static_cast<_FP16>(176), static_cast<_FP16>(225), + static_cast<_FP16>(230), static_cast<_FP16>(235), + static_cast<_FP16>(240), static_cast<_FP16>(245), + static_cast<_FP16>(300), static_cast<_FP16>(306), + static_cast<_FP16>(312), static_cast<_FP16>(318), + static_cast<_FP16>(324), static_cast<_FP16>(385), + static_cast<_FP16>(392), static_cast<_FP16>(399), + static_cast<_FP16>(406), static_cast<_FP16>(413), + static_cast<_FP16>(240), static_cast<_FP16>(244), + static_cast<_FP16>(248), static_cast<_FP16>(252), + static_cast<_FP16>(256), static_cast<_FP16>(325), + static_cast<_FP16>(330), static_cast<_FP16>(335), + static_cast<_FP16>(340), static_cast<_FP16>(345), + static_cast<_FP16>(420), static_cast<_FP16>(426), + static_cast<_FP16>(432), static_cast<_FP16>(438), + static_cast<_FP16>(444), static_cast<_FP16>(525), + static_cast<_FP16>(532), static_cast<_FP16>(539), + static_cast<_FP16>(546), static_cast<_FP16>(553), + static_cast<_FP16>(640), static_cast<_FP16>(648), + static_cast<_FP16>(656), static_cast<_FP16>(664), + static_cast<_FP16>(672), static_cast<_FP16>(765), + static_cast<_FP16>(774), static_cast<_FP16>(783), + static_cast<_FP16>(792), static_cast<_FP16>(801), + static_cast<_FP16>(900), static_cast<_FP16>(910), + static_cast<_FP16>(920), static_cast<_FP16>(930), + static_cast<_FP16>(940), static_cast<_FP16>(1045), + static_cast<_FP16>(1056), static_cast<_FP16>(1067), + static_cast<_FP16>(1078), static_cast<_FP16>(1089), + static_cast<_FP16>(800), static_cast<_FP16>(808), + static_cast<_FP16>(816), static_cast<_FP16>(824), + static_cast<_FP16>(832), static_cast<_FP16>(945), + static_cast<_FP16>(954), static_cast<_FP16>(963), + static_cast<_FP16>(972), static_cast<_FP16>(981), + static_cast<_FP16>(1100), static_cast<_FP16>(1110), + static_cast<_FP16>(1120), static_cast<_FP16>(1130), + static_cast<_FP16>(1140), static_cast<_FP16>(1265), + static_cast<_FP16>(1276), static_cast<_FP16>(1287), + static_cast<_FP16>(1298), static_cast<_FP16>(1309)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -614,67 +608,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 1, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(4), static_cast<_Float16>(9), - static_cast<_Float16>(16), static_cast<_Float16>(0), - static_cast<_Float16>(6), static_cast<_Float16>(14), - static_cast<_Float16>(24), static_cast<_Float16>(36), - static_cast<_Float16>(0), static_cast<_Float16>(11), - static_cast<_Float16>(24), static_cast<_Float16>(39), - static_cast<_Float16>(56), static_cast<_Float16>(0), - static_cast<_Float16>(16), static_cast<_Float16>(34), - static_cast<_Float16>(54), static_cast<_Float16>(76), - static_cast<_Float16>(0), static_cast<_Float16>(21), - static_cast<_Float16>(44), static_cast<_Float16>(69), - static_cast<_Float16>(96), static_cast<_Float16>(0), - static_cast<_Float16>(26), static_cast<_Float16>(54), - static_cast<_Float16>(84), static_cast<_Float16>(116), - static_cast<_Float16>(0), static_cast<_Float16>(31), - static_cast<_Float16>(64), static_cast<_Float16>(99), - static_cast<_Float16>(136), static_cast<_Float16>(0), - static_cast<_Float16>(36), static_cast<_Float16>(74), - static_cast<_Float16>(114), static_cast<_Float16>(156), - static_cast<_Float16>(0), static_cast<_Float16>(41), - static_cast<_Float16>(84), static_cast<_Float16>(129), - static_cast<_Float16>(176), static_cast<_Float16>(0), - static_cast<_Float16>(46), static_cast<_Float16>(94), - static_cast<_Float16>(144), static_cast<_Float16>(196), - static_cast<_Float16>(0), static_cast<_Float16>(51), - static_cast<_Float16>(104), static_cast<_Float16>(159), - static_cast<_Float16>(216), static_cast<_Float16>(0), - static_cast<_Float16>(56), static_cast<_Float16>(114), - static_cast<_Float16>(174), static_cast<_Float16>(236), - static_cast<_Float16>(0), static_cast<_Float16>(61), - static_cast<_Float16>(124), static_cast<_Float16>(189), - static_cast<_Float16>(256), static_cast<_Float16>(0), - static_cast<_Float16>(66), static_cast<_Float16>(134), - static_cast<_Float16>(204), static_cast<_Float16>(276), - static_cast<_Float16>(0), static_cast<_Float16>(71), - static_cast<_Float16>(144), static_cast<_Float16>(219), - static_cast<_Float16>(296), static_cast<_Float16>(0), - static_cast<_Float16>(76), static_cast<_Float16>(154), - static_cast<_Float16>(234), static_cast<_Float16>(316), - static_cast<_Float16>(0), static_cast<_Float16>(81), - static_cast<_Float16>(164), static_cast<_Float16>(249), - static_cast<_Float16>(336), static_cast<_Float16>(0), - static_cast<_Float16>(86), static_cast<_Float16>(174), - static_cast<_Float16>(264), static_cast<_Float16>(356), - static_cast<_Float16>(0), static_cast<_Float16>(91), - static_cast<_Float16>(184), static_cast<_Float16>(279), - static_cast<_Float16>(376), static_cast<_Float16>(0), - static_cast<_Float16>(96), static_cast<_Float16>(194), - static_cast<_Float16>(294), static_cast<_Float16>(396), - static_cast<_Float16>(0), static_cast<_Float16>(101), - static_cast<_Float16>(204), static_cast<_Float16>(309), - static_cast<_Float16>(416), static_cast<_Float16>(0), - static_cast<_Float16>(106), static_cast<_Float16>(214), - static_cast<_Float16>(324), static_cast<_Float16>(436), - static_cast<_Float16>(0), static_cast<_Float16>(111), - static_cast<_Float16>(224), static_cast<_Float16>(339), - static_cast<_Float16>(456), static_cast<_Float16>(0), - static_cast<_Float16>(116), static_cast<_Float16>(234), - static_cast<_Float16>(354), static_cast<_Float16>(476)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(4), static_cast<_FP16>(9), + static_cast<_FP16>(16), static_cast<_FP16>(0), + static_cast<_FP16>(6), static_cast<_FP16>(14), + static_cast<_FP16>(24), static_cast<_FP16>(36), + static_cast<_FP16>(0), static_cast<_FP16>(11), + static_cast<_FP16>(24), static_cast<_FP16>(39), + static_cast<_FP16>(56), static_cast<_FP16>(0), + static_cast<_FP16>(16), static_cast<_FP16>(34), + static_cast<_FP16>(54), static_cast<_FP16>(76), + static_cast<_FP16>(0), static_cast<_FP16>(21), + static_cast<_FP16>(44), static_cast<_FP16>(69), + static_cast<_FP16>(96), static_cast<_FP16>(0), + static_cast<_FP16>(26), static_cast<_FP16>(54), + static_cast<_FP16>(84), static_cast<_FP16>(116), + static_cast<_FP16>(0), static_cast<_FP16>(31), + static_cast<_FP16>(64), static_cast<_FP16>(99), + static_cast<_FP16>(136), static_cast<_FP16>(0), + static_cast<_FP16>(36), static_cast<_FP16>(74), + static_cast<_FP16>(114), static_cast<_FP16>(156), + static_cast<_FP16>(0), static_cast<_FP16>(41), + static_cast<_FP16>(84), static_cast<_FP16>(129), + static_cast<_FP16>(176), static_cast<_FP16>(0), + static_cast<_FP16>(46), static_cast<_FP16>(94), + static_cast<_FP16>(144), static_cast<_FP16>(196), + static_cast<_FP16>(0), static_cast<_FP16>(51), + static_cast<_FP16>(104), static_cast<_FP16>(159), + static_cast<_FP16>(216), static_cast<_FP16>(0), + static_cast<_FP16>(56), static_cast<_FP16>(114), + static_cast<_FP16>(174), static_cast<_FP16>(236), + static_cast<_FP16>(0), static_cast<_FP16>(61), + static_cast<_FP16>(124), static_cast<_FP16>(189), + static_cast<_FP16>(256), static_cast<_FP16>(0), + static_cast<_FP16>(66), static_cast<_FP16>(134), + static_cast<_FP16>(204), static_cast<_FP16>(276), + static_cast<_FP16>(0), static_cast<_FP16>(71), + static_cast<_FP16>(144), static_cast<_FP16>(219), + static_cast<_FP16>(296), static_cast<_FP16>(0), + static_cast<_FP16>(76), static_cast<_FP16>(154), + static_cast<_FP16>(234), static_cast<_FP16>(316), + static_cast<_FP16>(0), static_cast<_FP16>(81), + static_cast<_FP16>(164), static_cast<_FP16>(249), + static_cast<_FP16>(336), static_cast<_FP16>(0), + static_cast<_FP16>(86), static_cast<_FP16>(174), + static_cast<_FP16>(264), static_cast<_FP16>(356), + static_cast<_FP16>(0), static_cast<_FP16>(91), + static_cast<_FP16>(184), static_cast<_FP16>(279), + static_cast<_FP16>(376), static_cast<_FP16>(0), + static_cast<_FP16>(96), static_cast<_FP16>(194), + static_cast<_FP16>(294), static_cast<_FP16>(396), + static_cast<_FP16>(0), static_cast<_FP16>(101), + static_cast<_FP16>(204), static_cast<_FP16>(309), + static_cast<_FP16>(416), static_cast<_FP16>(0), + static_cast<_FP16>(106), static_cast<_FP16>(214), + static_cast<_FP16>(324), static_cast<_FP16>(436), + static_cast<_FP16>(0), static_cast<_FP16>(111), + static_cast<_FP16>(224), static_cast<_FP16>(339), + static_cast<_FP16>(456), static_cast<_FP16>(0), + static_cast<_FP16>(116), static_cast<_FP16>(234), + static_cast<_FP16>(354), static_cast<_FP16>(476)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -687,67 +680,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 2, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(20), static_cast<_Float16>(21), - static_cast<_Float16>(22), static_cast<_Float16>(23), - static_cast<_Float16>(24), static_cast<_Float16>(25), - static_cast<_Float16>(26), static_cast<_Float16>(27), - static_cast<_Float16>(28), static_cast<_Float16>(29), - static_cast<_Float16>(30), static_cast<_Float16>(31), - static_cast<_Float16>(32), static_cast<_Float16>(33), - static_cast<_Float16>(34), static_cast<_Float16>(35), - static_cast<_Float16>(36), static_cast<_Float16>(37), - static_cast<_Float16>(38), static_cast<_Float16>(39), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(60), static_cast<_Float16>(61), - static_cast<_Float16>(62), static_cast<_Float16>(63), - static_cast<_Float16>(64), static_cast<_Float16>(65), - static_cast<_Float16>(66), static_cast<_Float16>(67), - static_cast<_Float16>(68), static_cast<_Float16>(69), - static_cast<_Float16>(70), static_cast<_Float16>(71), - static_cast<_Float16>(72), static_cast<_Float16>(73), - static_cast<_Float16>(74), static_cast<_Float16>(75), - static_cast<_Float16>(76), static_cast<_Float16>(77), - static_cast<_Float16>(78), static_cast<_Float16>(79), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(100), static_cast<_Float16>(101), - static_cast<_Float16>(102), static_cast<_Float16>(103), - static_cast<_Float16>(104), static_cast<_Float16>(105), - static_cast<_Float16>(106), static_cast<_Float16>(107), - static_cast<_Float16>(108), static_cast<_Float16>(109), - static_cast<_Float16>(110), static_cast<_Float16>(111), - static_cast<_Float16>(112), static_cast<_Float16>(113), - static_cast<_Float16>(114), static_cast<_Float16>(115), - static_cast<_Float16>(116), static_cast<_Float16>(117), - static_cast<_Float16>(118), static_cast<_Float16>(119)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(20), static_cast<_FP16>(21), + static_cast<_FP16>(22), static_cast<_FP16>(23), + static_cast<_FP16>(24), static_cast<_FP16>(25), + static_cast<_FP16>(26), static_cast<_FP16>(27), + static_cast<_FP16>(28), static_cast<_FP16>(29), + static_cast<_FP16>(30), static_cast<_FP16>(31), + static_cast<_FP16>(32), static_cast<_FP16>(33), + static_cast<_FP16>(34), static_cast<_FP16>(35), + static_cast<_FP16>(36), static_cast<_FP16>(37), + static_cast<_FP16>(38), static_cast<_FP16>(39), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(60), static_cast<_FP16>(61), + static_cast<_FP16>(62), static_cast<_FP16>(63), + static_cast<_FP16>(64), static_cast<_FP16>(65), + static_cast<_FP16>(66), static_cast<_FP16>(67), + static_cast<_FP16>(68), static_cast<_FP16>(69), + static_cast<_FP16>(70), static_cast<_FP16>(71), + static_cast<_FP16>(72), static_cast<_FP16>(73), + static_cast<_FP16>(74), static_cast<_FP16>(75), + static_cast<_FP16>(76), static_cast<_FP16>(77), + static_cast<_FP16>(78), static_cast<_FP16>(79), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(100), static_cast<_FP16>(101), + static_cast<_FP16>(102), static_cast<_FP16>(103), + static_cast<_FP16>(104), static_cast<_FP16>(105), + static_cast<_FP16>(106), static_cast<_FP16>(107), + static_cast<_FP16>(108), static_cast<_FP16>(109), + static_cast<_FP16>(110), static_cast<_FP16>(111), + static_cast<_FP16>(112), static_cast<_FP16>(113), + static_cast<_FP16>(114), static_cast<_FP16>(115), + static_cast<_FP16>(116), static_cast<_FP16>(117), + static_cast<_FP16>(118), static_cast<_FP16>(119)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -760,67 +752,66 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(0), static_cast<_Float16>(0), - static_cast<_Float16>(40), static_cast<_Float16>(41), - static_cast<_Float16>(42), static_cast<_Float16>(43), - static_cast<_Float16>(44), static_cast<_Float16>(45), - static_cast<_Float16>(46), static_cast<_Float16>(47), - static_cast<_Float16>(48), static_cast<_Float16>(49), - static_cast<_Float16>(50), static_cast<_Float16>(51), - static_cast<_Float16>(52), static_cast<_Float16>(53), - static_cast<_Float16>(54), static_cast<_Float16>(55), - static_cast<_Float16>(56), static_cast<_Float16>(57), - static_cast<_Float16>(58), static_cast<_Float16>(59), - static_cast<_Float16>(60), static_cast<_Float16>(61), - static_cast<_Float16>(62), static_cast<_Float16>(63), - static_cast<_Float16>(64), static_cast<_Float16>(65), - static_cast<_Float16>(66), static_cast<_Float16>(67), - static_cast<_Float16>(68), static_cast<_Float16>(69), - static_cast<_Float16>(70), static_cast<_Float16>(71), - static_cast<_Float16>(72), static_cast<_Float16>(73), - static_cast<_Float16>(74), static_cast<_Float16>(75), - static_cast<_Float16>(76), static_cast<_Float16>(77), - static_cast<_Float16>(78), static_cast<_Float16>(79), - static_cast<_Float16>(160), static_cast<_Float16>(162), - static_cast<_Float16>(164), static_cast<_Float16>(166), - static_cast<_Float16>(168), static_cast<_Float16>(170), - static_cast<_Float16>(172), static_cast<_Float16>(174), - static_cast<_Float16>(176), static_cast<_Float16>(178), - static_cast<_Float16>(180), static_cast<_Float16>(182), - static_cast<_Float16>(184), static_cast<_Float16>(186), - static_cast<_Float16>(188), static_cast<_Float16>(190), - static_cast<_Float16>(192), static_cast<_Float16>(194), - static_cast<_Float16>(196), static_cast<_Float16>(198), - static_cast<_Float16>(200), static_cast<_Float16>(202), - static_cast<_Float16>(204), static_cast<_Float16>(206), - static_cast<_Float16>(208), static_cast<_Float16>(210), - static_cast<_Float16>(212), static_cast<_Float16>(214), - static_cast<_Float16>(216), static_cast<_Float16>(218), - static_cast<_Float16>(220), static_cast<_Float16>(222), - static_cast<_Float16>(224), static_cast<_Float16>(226), - static_cast<_Float16>(228), static_cast<_Float16>(230), - static_cast<_Float16>(232), static_cast<_Float16>(234), - static_cast<_Float16>(236), static_cast<_Float16>(238)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(0), static_cast<_FP16>(0), + static_cast<_FP16>(40), static_cast<_FP16>(41), + static_cast<_FP16>(42), static_cast<_FP16>(43), + static_cast<_FP16>(44), static_cast<_FP16>(45), + static_cast<_FP16>(46), static_cast<_FP16>(47), + static_cast<_FP16>(48), static_cast<_FP16>(49), + static_cast<_FP16>(50), static_cast<_FP16>(51), + static_cast<_FP16>(52), static_cast<_FP16>(53), + static_cast<_FP16>(54), static_cast<_FP16>(55), + static_cast<_FP16>(56), static_cast<_FP16>(57), + static_cast<_FP16>(58), static_cast<_FP16>(59), + static_cast<_FP16>(60), static_cast<_FP16>(61), + static_cast<_FP16>(62), static_cast<_FP16>(63), + static_cast<_FP16>(64), static_cast<_FP16>(65), + static_cast<_FP16>(66), static_cast<_FP16>(67), + static_cast<_FP16>(68), static_cast<_FP16>(69), + static_cast<_FP16>(70), static_cast<_FP16>(71), + static_cast<_FP16>(72), static_cast<_FP16>(73), + static_cast<_FP16>(74), static_cast<_FP16>(75), + static_cast<_FP16>(76), static_cast<_FP16>(77), + static_cast<_FP16>(78), static_cast<_FP16>(79), + static_cast<_FP16>(160), static_cast<_FP16>(162), + static_cast<_FP16>(164), static_cast<_FP16>(166), + static_cast<_FP16>(168), static_cast<_FP16>(170), + static_cast<_FP16>(172), static_cast<_FP16>(174), + static_cast<_FP16>(176), static_cast<_FP16>(178), + static_cast<_FP16>(180), static_cast<_FP16>(182), + static_cast<_FP16>(184), static_cast<_FP16>(186), + static_cast<_FP16>(188), static_cast<_FP16>(190), + static_cast<_FP16>(192), static_cast<_FP16>(194), + static_cast<_FP16>(196), static_cast<_FP16>(198), + static_cast<_FP16>(200), static_cast<_FP16>(202), + static_cast<_FP16>(204), static_cast<_FP16>(206), + static_cast<_FP16>(208), static_cast<_FP16>(210), + static_cast<_FP16>(212), static_cast<_FP16>(214), + static_cast<_FP16>(216), static_cast<_FP16>(218), + static_cast<_FP16>(220), static_cast<_FP16>(222), + static_cast<_FP16>(224), static_cast<_FP16>(226), + static_cast<_FP16>(228), static_cast<_FP16>(230), + static_cast<_FP16>(232), static_cast<_FP16>(234), + static_cast<_FP16>(236), static_cast<_FP16>(238)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -833,37 +824,36 @@ TEST(nntrainer_Tensor, multiply_i_broadcast_01_fp16_p) { ranged(3, 5, 1, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 1, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(4), static_cast<_Float16>(9), - static_cast<_Float16>(0), static_cast<_Float16>(5), - static_cast<_Float16>(12), static_cast<_Float16>(21), - static_cast<_Float16>(0), static_cast<_Float16>(9), - static_cast<_Float16>(20), static_cast<_Float16>(33), - static_cast<_Float16>(0), static_cast<_Float16>(13), - static_cast<_Float16>(28), static_cast<_Float16>(45), - static_cast<_Float16>(0), static_cast<_Float16>(17), - static_cast<_Float16>(36), static_cast<_Float16>(57), - static_cast<_Float16>(80), static_cast<_Float16>(105), - static_cast<_Float16>(132), static_cast<_Float16>(161), - static_cast<_Float16>(96), static_cast<_Float16>(125), - static_cast<_Float16>(156), static_cast<_Float16>(189), - static_cast<_Float16>(112), static_cast<_Float16>(145), - static_cast<_Float16>(180), static_cast<_Float16>(217), - static_cast<_Float16>(128), static_cast<_Float16>(165), - static_cast<_Float16>(204), static_cast<_Float16>(245), - static_cast<_Float16>(144), static_cast<_Float16>(185), - static_cast<_Float16>(228), static_cast<_Float16>(273), - static_cast<_Float16>(320), static_cast<_Float16>(369), - static_cast<_Float16>(420), static_cast<_Float16>(473), - static_cast<_Float16>(352), static_cast<_Float16>(405), - static_cast<_Float16>(460), static_cast<_Float16>(517), - static_cast<_Float16>(384), static_cast<_Float16>(441), - static_cast<_Float16>(500), static_cast<_Float16>(561), - static_cast<_Float16>(416), static_cast<_Float16>(477), - static_cast<_Float16>(540), static_cast<_Float16>(605), - static_cast<_Float16>(448), static_cast<_Float16>(513), - static_cast<_Float16>(580), static_cast<_Float16>(649)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(4), static_cast<_FP16>(9), + static_cast<_FP16>(0), static_cast<_FP16>(5), + static_cast<_FP16>(12), static_cast<_FP16>(21), + static_cast<_FP16>(0), static_cast<_FP16>(9), + static_cast<_FP16>(20), static_cast<_FP16>(33), + static_cast<_FP16>(0), static_cast<_FP16>(13), + static_cast<_FP16>(28), static_cast<_FP16>(45), + static_cast<_FP16>(0), static_cast<_FP16>(17), + static_cast<_FP16>(36), static_cast<_FP16>(57), + static_cast<_FP16>(80), static_cast<_FP16>(105), + static_cast<_FP16>(132), static_cast<_FP16>(161), + static_cast<_FP16>(96), static_cast<_FP16>(125), + static_cast<_FP16>(156), static_cast<_FP16>(189), + static_cast<_FP16>(112), static_cast<_FP16>(145), + static_cast<_FP16>(180), static_cast<_FP16>(217), + static_cast<_FP16>(128), static_cast<_FP16>(165), + static_cast<_FP16>(204), static_cast<_FP16>(245), + static_cast<_FP16>(144), static_cast<_FP16>(185), + static_cast<_FP16>(228), static_cast<_FP16>(273), + static_cast<_FP16>(320), static_cast<_FP16>(369), + static_cast<_FP16>(420), static_cast<_FP16>(473), + static_cast<_FP16>(352), static_cast<_FP16>(405), + static_cast<_FP16>(460), static_cast<_FP16>(517), + static_cast<_FP16>(384), static_cast<_FP16>(441), + static_cast<_FP16>(500), static_cast<_FP16>(561), + static_cast<_FP16>(416), static_cast<_FP16>(477), + static_cast<_FP16>(540), static_cast<_FP16>(605), + static_cast<_FP16>(448), static_cast<_FP16>(513), + static_cast<_FP16>(580), static_cast<_FP16>(649)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.multiply_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -902,7 +892,7 @@ TEST(nntrainer_Tensor, multiply_01_p) { GEN_TEST_INPUT(input, i * (batch * height) + j * (width) + k); nntrainer::Tensor result = input.multiply(0.0); - if (result.getValue<_Float16>(0, 0, 1, 1) != 0.0) + if (result.getValue<_FP16>(0, 0, 1, 1) != 0.0) status = ML_ERROR_RESULT_OUT_OF_RANGE; EXPECT_EQ(status, ML_ERROR_NONE); } @@ -920,9 +910,9 @@ TEST(nntrainer_Tensor, multiply_02_p) { nntrainer::Tensor result = input.multiply(input); - _Float16 *data = result.getData<_Float16>(); + _FP16 *data = result.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width; ++i) { @@ -1067,9 +1057,9 @@ TEST(nntrainer_Tensor, divide_i_01_p) { status = input.divide_i(2.0f); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *data = original.getData<_Float16>(); + _FP16 *data = original.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width * channel; ++i) { @@ -1090,11 +1080,11 @@ TEST(nntrainer_Tensor, divide_i_02_p) { status = input.divide_i(input); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width * channel; ++i) { - EXPECT_FLOAT_EQ(indata[i], _Float16(1.0)); + EXPECT_FLOAT_EQ(indata[i], _FP16(1.0)); } } @@ -1109,7 +1099,7 @@ TEST(nntrainer_Tensor, divide_i_01_n) { nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); GEN_TEST_INPUT(input, i * (batch * height) + j * (width) + k); - status = input.divide_i((_Float16)0); + status = input.divide_i((_FP16)0); EXPECT_EQ(status, ML_ERROR_INVALID_PARAMETER); } @@ -1144,9 +1134,9 @@ TEST(nntrainer_Tensor, divide_01_p) { nntrainer::Tensor result = input.divide(1.0); - _Float16 *previous = input.getData<_Float16>(); + _FP16 *previous = input.getData<_FP16>(); ASSERT_NE(nullptr, previous); - _Float16 *data = result.getData<_Float16>(); + _FP16 *data = result.getData<_FP16>(); ASSERT_NE(nullptr, data); for (int i = 0; i < batch * height * width * channel; ++i) { @@ -1274,67 +1264,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(1, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(41.0), static_cast<_Float16>(21.0), - static_cast<_Float16>(14.333333), static_cast<_Float16>(11.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(7.6666665), - static_cast<_Float16>(6.714286), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.4444447), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.6363635), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(4.076923), static_cast<_Float16>(3.857143), - static_cast<_Float16>(3.6666667), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.3529413), static_cast<_Float16>(3.2222223), - static_cast<_Float16>(3.1052632), static_cast<_Float16>(3.0), - static_cast<_Float16>(2.9047618), static_cast<_Float16>(2.8181818), - static_cast<_Float16>(2.7391305), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.6), static_cast<_Float16>(2.5384614), - static_cast<_Float16>(2.4814816), static_cast<_Float16>(2.4285715), - static_cast<_Float16>(2.3793104), static_cast<_Float16>(2.3333333), - static_cast<_Float16>(2.2903225), static_cast<_Float16>(2.25), - static_cast<_Float16>(2.2121212), static_cast<_Float16>(2.1764705), - static_cast<_Float16>(2.142857), static_cast<_Float16>(2.1111112), - static_cast<_Float16>(2.0810812), static_cast<_Float16>(2.0526316), - static_cast<_Float16>(2.025641), static_cast<_Float16>(2.0), - static_cast<_Float16>(81.0), static_cast<_Float16>(41.0), - static_cast<_Float16>(27.666666), static_cast<_Float16>(21.0), - static_cast<_Float16>(17.0), static_cast<_Float16>(14.333333), - static_cast<_Float16>(12.428572), static_cast<_Float16>(11.0), - static_cast<_Float16>(9.888889), static_cast<_Float16>(9.0), - static_cast<_Float16>(8.272727), static_cast<_Float16>(7.6666665), - static_cast<_Float16>(7.1538463), static_cast<_Float16>(6.714286), - static_cast<_Float16>(6.3333335), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.7058825), static_cast<_Float16>(5.4444447), - static_cast<_Float16>(5.2105265), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.8095236), static_cast<_Float16>(4.6363635), - static_cast<_Float16>(4.478261), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(4.2), static_cast<_Float16>(4.076923), - static_cast<_Float16>(3.9629629), static_cast<_Float16>(3.857143), - static_cast<_Float16>(3.7586207), static_cast<_Float16>(3.6666667), - static_cast<_Float16>(3.580645), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.4242425), static_cast<_Float16>(3.3529413), - static_cast<_Float16>(3.2857144), static_cast<_Float16>(3.2222223), - static_cast<_Float16>(3.162162), static_cast<_Float16>(3.1052632), - static_cast<_Float16>(3.0512822), static_cast<_Float16>(3.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(41.0), static_cast<_FP16>(21.0), + static_cast<_FP16>(14.333333), static_cast<_FP16>(11.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(7.6666665), + static_cast<_FP16>(6.714286), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.4444447), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.6363635), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(4.076923), static_cast<_FP16>(3.857143), + static_cast<_FP16>(3.6666667), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.3529413), static_cast<_FP16>(3.2222223), + static_cast<_FP16>(3.1052632), static_cast<_FP16>(3.0), + static_cast<_FP16>(2.9047618), static_cast<_FP16>(2.8181818), + static_cast<_FP16>(2.7391305), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.6), static_cast<_FP16>(2.5384614), + static_cast<_FP16>(2.4814816), static_cast<_FP16>(2.4285715), + static_cast<_FP16>(2.3793104), static_cast<_FP16>(2.3333333), + static_cast<_FP16>(2.2903225), static_cast<_FP16>(2.25), + static_cast<_FP16>(2.2121212), static_cast<_FP16>(2.1764705), + static_cast<_FP16>(2.142857), static_cast<_FP16>(2.1111112), + static_cast<_FP16>(2.0810812), static_cast<_FP16>(2.0526316), + static_cast<_FP16>(2.025641), static_cast<_FP16>(2.0), + static_cast<_FP16>(81.0), static_cast<_FP16>(41.0), + static_cast<_FP16>(27.666666), static_cast<_FP16>(21.0), + static_cast<_FP16>(17.0), static_cast<_FP16>(14.333333), + static_cast<_FP16>(12.428572), static_cast<_FP16>(11.0), + static_cast<_FP16>(9.888889), static_cast<_FP16>(9.0), + static_cast<_FP16>(8.272727), static_cast<_FP16>(7.6666665), + static_cast<_FP16>(7.1538463), static_cast<_FP16>(6.714286), + static_cast<_FP16>(6.3333335), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.7058825), static_cast<_FP16>(5.4444447), + static_cast<_FP16>(5.2105265), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.8095236), static_cast<_FP16>(4.6363635), + static_cast<_FP16>(4.478261), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(4.2), static_cast<_FP16>(4.076923), + static_cast<_FP16>(3.9629629), static_cast<_FP16>(3.857143), + static_cast<_FP16>(3.7586207), static_cast<_FP16>(3.6666667), + static_cast<_FP16>(3.580645), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.4242425), static_cast<_FP16>(3.3529413), + static_cast<_FP16>(3.2857144), static_cast<_FP16>(3.2222223), + static_cast<_FP16>(3.162162), static_cast<_FP16>(3.1052632), + static_cast<_FP16>(3.0512822), static_cast<_FP16>(3.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1349,67 +1339,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(3, 1, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(11.0), - static_cast<_Float16>(7.6666665), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(3.857143), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.2222223), static_cast<_Float16>(3.0), - static_cast<_Float16>(2.8181818), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.5384614), static_cast<_Float16>(2.4285715), - static_cast<_Float16>(2.3333333), static_cast<_Float16>(2.25), - static_cast<_Float16>(2.1764705), static_cast<_Float16>(2.1111112), - static_cast<_Float16>(2.0526316), static_cast<_Float16>(2.0), - static_cast<_Float16>(1.9523809), static_cast<_Float16>(1.9090909), - static_cast<_Float16>(1.8695652), static_cast<_Float16>(1.8333334), - static_cast<_Float16>(1.8), static_cast<_Float16>(1.7692307), - static_cast<_Float16>(1.7407408), static_cast<_Float16>(1.7142857), - static_cast<_Float16>(1.6896552), static_cast<_Float16>(1.6666666), - static_cast<_Float16>(1.6451613), static_cast<_Float16>(1.625), - static_cast<_Float16>(1.6060606), static_cast<_Float16>(1.5882353), - static_cast<_Float16>(1.5714285), static_cast<_Float16>(1.5555556), - static_cast<_Float16>(1.5405406), static_cast<_Float16>(1.5263158), - static_cast<_Float16>(1.5128205), static_cast<_Float16>(1.5), - static_cast<_Float16>(2.9047618), static_cast<_Float16>(2.8181818), - static_cast<_Float16>(2.7391305), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.6), static_cast<_Float16>(2.5384614), - static_cast<_Float16>(2.4814816), static_cast<_Float16>(2.4285715), - static_cast<_Float16>(2.3793104), static_cast<_Float16>(2.3333333), - static_cast<_Float16>(2.2903225), static_cast<_Float16>(2.25), - static_cast<_Float16>(2.2121212), static_cast<_Float16>(2.1764705), - static_cast<_Float16>(2.142857), static_cast<_Float16>(2.1111112), - static_cast<_Float16>(2.0810812), static_cast<_Float16>(2.0526316), - static_cast<_Float16>(2.025641), static_cast<_Float16>(2.0), - static_cast<_Float16>(1.9756098), static_cast<_Float16>(1.9523809), - static_cast<_Float16>(1.9302325), static_cast<_Float16>(1.9090909), - static_cast<_Float16>(1.8888888), static_cast<_Float16>(1.8695652), - static_cast<_Float16>(1.8510638), static_cast<_Float16>(1.8333334), - static_cast<_Float16>(1.8163265), static_cast<_Float16>(1.8), - static_cast<_Float16>(1.7843137), static_cast<_Float16>(1.7692307), - static_cast<_Float16>(1.754717), static_cast<_Float16>(1.7407408), - static_cast<_Float16>(1.7272727), static_cast<_Float16>(1.7142857), - static_cast<_Float16>(1.7017543), static_cast<_Float16>(1.6896552), - static_cast<_Float16>(1.6779661), static_cast<_Float16>(1.6666666), - static_cast<_Float16>(2.4634147), static_cast<_Float16>(2.4285715), - static_cast<_Float16>(2.3953488), static_cast<_Float16>(2.3636363), - static_cast<_Float16>(2.3333333), static_cast<_Float16>(2.3043478), - static_cast<_Float16>(2.2765958), static_cast<_Float16>(2.25), - static_cast<_Float16>(2.2244897), static_cast<_Float16>(2.2), - static_cast<_Float16>(2.1764705), static_cast<_Float16>(2.1538463), - static_cast<_Float16>(2.1320755), static_cast<_Float16>(2.1111112), - static_cast<_Float16>(2.090909), static_cast<_Float16>(2.0714285), - static_cast<_Float16>(2.0526316), static_cast<_Float16>(2.0344827), - static_cast<_Float16>(2.0169492), static_cast<_Float16>(2.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(11.0), + static_cast<_FP16>(7.6666665), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(3.857143), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.2222223), static_cast<_FP16>(3.0), + static_cast<_FP16>(2.8181818), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.5384614), static_cast<_FP16>(2.4285715), + static_cast<_FP16>(2.3333333), static_cast<_FP16>(2.25), + static_cast<_FP16>(2.1764705), static_cast<_FP16>(2.1111112), + static_cast<_FP16>(2.0526316), static_cast<_FP16>(2.0), + static_cast<_FP16>(1.9523809), static_cast<_FP16>(1.9090909), + static_cast<_FP16>(1.8695652), static_cast<_FP16>(1.8333334), + static_cast<_FP16>(1.8), static_cast<_FP16>(1.7692307), + static_cast<_FP16>(1.7407408), static_cast<_FP16>(1.7142857), + static_cast<_FP16>(1.6896552), static_cast<_FP16>(1.6666666), + static_cast<_FP16>(1.6451613), static_cast<_FP16>(1.625), + static_cast<_FP16>(1.6060606), static_cast<_FP16>(1.5882353), + static_cast<_FP16>(1.5714285), static_cast<_FP16>(1.5555556), + static_cast<_FP16>(1.5405406), static_cast<_FP16>(1.5263158), + static_cast<_FP16>(1.5128205), static_cast<_FP16>(1.5), + static_cast<_FP16>(2.9047618), static_cast<_FP16>(2.8181818), + static_cast<_FP16>(2.7391305), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.6), static_cast<_FP16>(2.5384614), + static_cast<_FP16>(2.4814816), static_cast<_FP16>(2.4285715), + static_cast<_FP16>(2.3793104), static_cast<_FP16>(2.3333333), + static_cast<_FP16>(2.2903225), static_cast<_FP16>(2.25), + static_cast<_FP16>(2.2121212), static_cast<_FP16>(2.1764705), + static_cast<_FP16>(2.142857), static_cast<_FP16>(2.1111112), + static_cast<_FP16>(2.0810812), static_cast<_FP16>(2.0526316), + static_cast<_FP16>(2.025641), static_cast<_FP16>(2.0), + static_cast<_FP16>(1.9756098), static_cast<_FP16>(1.9523809), + static_cast<_FP16>(1.9302325), static_cast<_FP16>(1.9090909), + static_cast<_FP16>(1.8888888), static_cast<_FP16>(1.8695652), + static_cast<_FP16>(1.8510638), static_cast<_FP16>(1.8333334), + static_cast<_FP16>(1.8163265), static_cast<_FP16>(1.8), + static_cast<_FP16>(1.7843137), static_cast<_FP16>(1.7692307), + static_cast<_FP16>(1.754717), static_cast<_FP16>(1.7407408), + static_cast<_FP16>(1.7272727), static_cast<_FP16>(1.7142857), + static_cast<_FP16>(1.7017543), static_cast<_FP16>(1.6896552), + static_cast<_FP16>(1.6779661), static_cast<_FP16>(1.6666666), + static_cast<_FP16>(2.4634147), static_cast<_FP16>(2.4285715), + static_cast<_FP16>(2.3953488), static_cast<_FP16>(2.3636363), + static_cast<_FP16>(2.3333333), static_cast<_FP16>(2.3043478), + static_cast<_FP16>(2.2765958), static_cast<_FP16>(2.25), + static_cast<_FP16>(2.2244897), static_cast<_FP16>(2.2), + static_cast<_FP16>(2.1764705), static_cast<_FP16>(2.1538463), + static_cast<_FP16>(2.1320755), static_cast<_FP16>(2.1111112), + static_cast<_FP16>(2.090909), static_cast<_FP16>(2.0714285), + static_cast<_FP16>(2.0526316), static_cast<_FP16>(2.0344827), + static_cast<_FP16>(2.0169492), static_cast<_FP16>(2.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1424,67 +1414,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(3, 2, 4, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(2.0), - static_cast<_Float16>(3.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(3.0), - static_cast<_Float16>(3.5), static_cast<_Float16>(4.0), - static_cast<_Float16>(4.5), static_cast<_Float16>(5.0), - static_cast<_Float16>(3.6666667), static_cast<_Float16>(4.0), - static_cast<_Float16>(4.3333335), static_cast<_Float16>(4.6666665), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(4.25), static_cast<_Float16>(4.5), - static_cast<_Float16>(4.75), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.2), static_cast<_Float16>(4.4), - static_cast<_Float16>(4.6), static_cast<_Float16>(4.8), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(4.5), static_cast<_Float16>(4.6666665), - static_cast<_Float16>(4.8333335), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.428571), static_cast<_Float16>(4.571429), - static_cast<_Float16>(4.714286), static_cast<_Float16>(4.857143), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.5), - static_cast<_Float16>(4.625), static_cast<_Float16>(4.75), - static_cast<_Float16>(4.875), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.5555553), static_cast<_Float16>(4.6666665), - static_cast<_Float16>(4.7777777), static_cast<_Float16>(4.888889), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.6), - static_cast<_Float16>(4.7), static_cast<_Float16>(4.8), - static_cast<_Float16>(4.9), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.6363635), static_cast<_Float16>(4.7272725), - static_cast<_Float16>(4.818182), static_cast<_Float16>(4.909091), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.6666665), - static_cast<_Float16>(4.75), static_cast<_Float16>(4.8333335), - static_cast<_Float16>(4.9166665), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.6923075), static_cast<_Float16>(4.769231), - static_cast<_Float16>(4.8461537), static_cast<_Float16>(4.923077), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.714286), - static_cast<_Float16>(4.785714), static_cast<_Float16>(4.857143), - static_cast<_Float16>(4.928571), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.733333), static_cast<_Float16>(4.8), - static_cast<_Float16>(4.866667), static_cast<_Float16>(4.9333334), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.75), - static_cast<_Float16>(4.8125), static_cast<_Float16>(4.875), - static_cast<_Float16>(4.9375), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.7647057), static_cast<_Float16>(4.8235292), - static_cast<_Float16>(4.882353), static_cast<_Float16>(4.9411764), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.7777777), - static_cast<_Float16>(4.8333335), static_cast<_Float16>(4.888889), - static_cast<_Float16>(4.9444447), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.7894735), static_cast<_Float16>(4.8421054), - static_cast<_Float16>(4.894737), static_cast<_Float16>(4.9473686), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.8), - static_cast<_Float16>(4.85), static_cast<_Float16>(4.9), - static_cast<_Float16>(4.95), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.8095236), static_cast<_Float16>(4.857143), - static_cast<_Float16>(4.904762), static_cast<_Float16>(4.952381), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.818182), - static_cast<_Float16>(4.8636365), static_cast<_Float16>(4.909091), - static_cast<_Float16>(4.9545455), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.826087), static_cast<_Float16>(4.869565), - static_cast<_Float16>(4.9130435), static_cast<_Float16>(4.9565215), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.8333335), - static_cast<_Float16>(4.875), static_cast<_Float16>(4.9166665), - static_cast<_Float16>(4.9583335), static_cast<_Float16>(5.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(2.0), + static_cast<_FP16>(3.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(3.0), + static_cast<_FP16>(3.5), static_cast<_FP16>(4.0), + static_cast<_FP16>(4.5), static_cast<_FP16>(5.0), + static_cast<_FP16>(3.6666667), static_cast<_FP16>(4.0), + static_cast<_FP16>(4.3333335), static_cast<_FP16>(4.6666665), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(4.25), static_cast<_FP16>(4.5), + static_cast<_FP16>(4.75), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.2), static_cast<_FP16>(4.4), + static_cast<_FP16>(4.6), static_cast<_FP16>(4.8), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(4.5), static_cast<_FP16>(4.6666665), + static_cast<_FP16>(4.8333335), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.428571), static_cast<_FP16>(4.571429), + static_cast<_FP16>(4.714286), static_cast<_FP16>(4.857143), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.5), + static_cast<_FP16>(4.625), static_cast<_FP16>(4.75), + static_cast<_FP16>(4.875), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.5555553), static_cast<_FP16>(4.6666665), + static_cast<_FP16>(4.7777777), static_cast<_FP16>(4.888889), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.6), + static_cast<_FP16>(4.7), static_cast<_FP16>(4.8), + static_cast<_FP16>(4.9), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.6363635), static_cast<_FP16>(4.7272725), + static_cast<_FP16>(4.818182), static_cast<_FP16>(4.909091), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.6666665), + static_cast<_FP16>(4.75), static_cast<_FP16>(4.8333335), + static_cast<_FP16>(4.9166665), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.6923075), static_cast<_FP16>(4.769231), + static_cast<_FP16>(4.8461537), static_cast<_FP16>(4.923077), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.714286), + static_cast<_FP16>(4.785714), static_cast<_FP16>(4.857143), + static_cast<_FP16>(4.928571), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.733333), static_cast<_FP16>(4.8), + static_cast<_FP16>(4.866667), static_cast<_FP16>(4.9333334), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.75), + static_cast<_FP16>(4.8125), static_cast<_FP16>(4.875), + static_cast<_FP16>(4.9375), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.7647057), static_cast<_FP16>(4.8235292), + static_cast<_FP16>(4.882353), static_cast<_FP16>(4.9411764), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.7777777), + static_cast<_FP16>(4.8333335), static_cast<_FP16>(4.888889), + static_cast<_FP16>(4.9444447), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.7894735), static_cast<_FP16>(4.8421054), + static_cast<_FP16>(4.894737), static_cast<_FP16>(4.9473686), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.8), + static_cast<_FP16>(4.85), static_cast<_FP16>(4.9), + static_cast<_FP16>(4.95), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.8095236), static_cast<_FP16>(4.857143), + static_cast<_FP16>(4.904762), static_cast<_FP16>(4.952381), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.818182), + static_cast<_FP16>(4.8636365), static_cast<_FP16>(4.909091), + static_cast<_FP16>(4.9545455), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.826087), static_cast<_FP16>(4.869565), + static_cast<_FP16>(4.9130435), static_cast<_FP16>(4.9565215), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.8333335), + static_cast<_FP16>(4.875), static_cast<_FP16>(4.9166665), + static_cast<_FP16>(4.9583335), static_cast<_FP16>(5.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1499,67 +1489,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(3, 1, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(3.5), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.25), static_cast<_Float16>(2.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(4.3333335), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(8.5), static_cast<_Float16>(6.0), - static_cast<_Float16>(4.75), static_cast<_Float16>(4.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(11.0), - static_cast<_Float16>(7.6666665), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(26.0), - static_cast<_Float16>(13.5), static_cast<_Float16>(9.333333), - static_cast<_Float16>(7.25), static_cast<_Float16>(6.0), - static_cast<_Float16>(31.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(8.5), - static_cast<_Float16>(7.0), static_cast<_Float16>(36.0), - static_cast<_Float16>(18.5), static_cast<_Float16>(12.666667), - static_cast<_Float16>(9.75), static_cast<_Float16>(8.0), - static_cast<_Float16>(6.8333335), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.375), static_cast<_Float16>(4.888889), - static_cast<_Float16>(4.5), static_cast<_Float16>(7.6666665), - static_cast<_Float16>(6.714286), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.4444447), static_cast<_Float16>(5.0), - static_cast<_Float16>(8.5), static_cast<_Float16>(7.428571), - static_cast<_Float16>(6.625), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.5), static_cast<_Float16>(9.333333), - static_cast<_Float16>(8.142858), static_cast<_Float16>(7.25), - static_cast<_Float16>(6.5555553), static_cast<_Float16>(6.0), - static_cast<_Float16>(10.166667), static_cast<_Float16>(8.857142), - static_cast<_Float16>(7.875), static_cast<_Float16>(7.111111), - static_cast<_Float16>(6.5), static_cast<_Float16>(11.0), - static_cast<_Float16>(9.571428), static_cast<_Float16>(8.5), - static_cast<_Float16>(7.6666665), static_cast<_Float16>(7.0), - static_cast<_Float16>(11.833333), static_cast<_Float16>(10.285714), - static_cast<_Float16>(9.125), static_cast<_Float16>(8.222222), - static_cast<_Float16>(7.5), static_cast<_Float16>(12.666667), - static_cast<_Float16>(11.0), static_cast<_Float16>(9.75), - static_cast<_Float16>(8.777778), static_cast<_Float16>(8.0), - static_cast<_Float16>(7.3636365), static_cast<_Float16>(6.8333335), - static_cast<_Float16>(6.3846154), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.6666665), static_cast<_Float16>(7.818182), - static_cast<_Float16>(7.25), static_cast<_Float16>(6.769231), - static_cast<_Float16>(6.357143), static_cast<_Float16>(6.0), - static_cast<_Float16>(8.272727), static_cast<_Float16>(7.6666665), - static_cast<_Float16>(7.1538463), static_cast<_Float16>(6.714286), - static_cast<_Float16>(6.3333335), static_cast<_Float16>(8.727273), - static_cast<_Float16>(8.083333), static_cast<_Float16>(7.5384617), - static_cast<_Float16>(7.071429), static_cast<_Float16>(6.6666665), - static_cast<_Float16>(9.181818), static_cast<_Float16>(8.5), - static_cast<_Float16>(7.923077), static_cast<_Float16>(7.428571), - static_cast<_Float16>(7.0), static_cast<_Float16>(9.636364), - static_cast<_Float16>(8.916667), static_cast<_Float16>(8.307693), - static_cast<_Float16>(7.785714), static_cast<_Float16>(7.3333335), - static_cast<_Float16>(10.090909), static_cast<_Float16>(9.333333), - static_cast<_Float16>(8.692307), static_cast<_Float16>(8.142858), - static_cast<_Float16>(7.6666665), static_cast<_Float16>(10.545455), - static_cast<_Float16>(9.75), static_cast<_Float16>(9.076923), - static_cast<_Float16>(8.5), static_cast<_Float16>(8.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(3.5), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.25), static_cast<_FP16>(2.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(4.3333335), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(8.5), static_cast<_FP16>(6.0), + static_cast<_FP16>(4.75), static_cast<_FP16>(4.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(11.0), + static_cast<_FP16>(7.6666665), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(26.0), + static_cast<_FP16>(13.5), static_cast<_FP16>(9.333333), + static_cast<_FP16>(7.25), static_cast<_FP16>(6.0), + static_cast<_FP16>(31.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(8.5), + static_cast<_FP16>(7.0), static_cast<_FP16>(36.0), + static_cast<_FP16>(18.5), static_cast<_FP16>(12.666667), + static_cast<_FP16>(9.75), static_cast<_FP16>(8.0), + static_cast<_FP16>(6.8333335), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.375), static_cast<_FP16>(4.888889), + static_cast<_FP16>(4.5), static_cast<_FP16>(7.6666665), + static_cast<_FP16>(6.714286), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.4444447), static_cast<_FP16>(5.0), + static_cast<_FP16>(8.5), static_cast<_FP16>(7.428571), + static_cast<_FP16>(6.625), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.5), static_cast<_FP16>(9.333333), + static_cast<_FP16>(8.142858), static_cast<_FP16>(7.25), + static_cast<_FP16>(6.5555553), static_cast<_FP16>(6.0), + static_cast<_FP16>(10.166667), static_cast<_FP16>(8.857142), + static_cast<_FP16>(7.875), static_cast<_FP16>(7.111111), + static_cast<_FP16>(6.5), static_cast<_FP16>(11.0), + static_cast<_FP16>(9.571428), static_cast<_FP16>(8.5), + static_cast<_FP16>(7.6666665), static_cast<_FP16>(7.0), + static_cast<_FP16>(11.833333), static_cast<_FP16>(10.285714), + static_cast<_FP16>(9.125), static_cast<_FP16>(8.222222), + static_cast<_FP16>(7.5), static_cast<_FP16>(12.666667), + static_cast<_FP16>(11.0), static_cast<_FP16>(9.75), + static_cast<_FP16>(8.777778), static_cast<_FP16>(8.0), + static_cast<_FP16>(7.3636365), static_cast<_FP16>(6.8333335), + static_cast<_FP16>(6.3846154), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.6666665), static_cast<_FP16>(7.818182), + static_cast<_FP16>(7.25), static_cast<_FP16>(6.769231), + static_cast<_FP16>(6.357143), static_cast<_FP16>(6.0), + static_cast<_FP16>(8.272727), static_cast<_FP16>(7.6666665), + static_cast<_FP16>(7.1538463), static_cast<_FP16>(6.714286), + static_cast<_FP16>(6.3333335), static_cast<_FP16>(8.727273), + static_cast<_FP16>(8.083333), static_cast<_FP16>(7.5384617), + static_cast<_FP16>(7.071429), static_cast<_FP16>(6.6666665), + static_cast<_FP16>(9.181818), static_cast<_FP16>(8.5), + static_cast<_FP16>(7.923077), static_cast<_FP16>(7.428571), + static_cast<_FP16>(7.0), static_cast<_FP16>(9.636364), + static_cast<_FP16>(8.916667), static_cast<_FP16>(8.307693), + static_cast<_FP16>(7.785714), static_cast<_FP16>(7.3333335), + static_cast<_FP16>(10.090909), static_cast<_FP16>(9.333333), + static_cast<_FP16>(8.692307), static_cast<_FP16>(8.142858), + static_cast<_FP16>(7.6666665), static_cast<_FP16>(10.545455), + static_cast<_FP16>(9.75), static_cast<_FP16>(9.076923), + static_cast<_FP16>(8.5), static_cast<_FP16>(8.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1574,67 +1564,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(1, 2, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(3.5), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.25), static_cast<_Float16>(2.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(4.3333335), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(8.5), static_cast<_Float16>(6.0), - static_cast<_Float16>(4.75), static_cast<_Float16>(4.0), - static_cast<_Float16>(3.5), static_cast<_Float16>(3.142857), - static_cast<_Float16>(2.875), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.5), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(3.857143), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.2222223), static_cast<_Float16>(3.0), - static_cast<_Float16>(5.1666665), static_cast<_Float16>(4.571429), - static_cast<_Float16>(4.125), static_cast<_Float16>(3.7777777), - static_cast<_Float16>(3.5), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.285714), static_cast<_Float16>(4.75), - static_cast<_Float16>(4.3333335), static_cast<_Float16>(4.0), - static_cast<_Float16>(41.0), static_cast<_Float16>(21.0), - static_cast<_Float16>(14.333333), static_cast<_Float16>(11.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(46.0), - static_cast<_Float16>(23.5), static_cast<_Float16>(16.0), - static_cast<_Float16>(12.25), static_cast<_Float16>(10.0), - static_cast<_Float16>(51.0), static_cast<_Float16>(26.0), - static_cast<_Float16>(17.666666), static_cast<_Float16>(13.5), - static_cast<_Float16>(11.0), static_cast<_Float16>(56.0), - static_cast<_Float16>(28.5), static_cast<_Float16>(19.333334), - static_cast<_Float16>(14.75), static_cast<_Float16>(12.0), - static_cast<_Float16>(10.166667), static_cast<_Float16>(8.857142), - static_cast<_Float16>(7.875), static_cast<_Float16>(7.111111), - static_cast<_Float16>(6.5), static_cast<_Float16>(11.0), - static_cast<_Float16>(9.571428), static_cast<_Float16>(8.5), - static_cast<_Float16>(7.6666665), static_cast<_Float16>(7.0), - static_cast<_Float16>(11.833333), static_cast<_Float16>(10.285714), - static_cast<_Float16>(9.125), static_cast<_Float16>(8.222222), - static_cast<_Float16>(7.5), static_cast<_Float16>(12.666667), - static_cast<_Float16>(11.0), static_cast<_Float16>(9.75), - static_cast<_Float16>(8.777778), static_cast<_Float16>(8.0), - static_cast<_Float16>(81.0), static_cast<_Float16>(41.0), - static_cast<_Float16>(27.666666), static_cast<_Float16>(21.0), - static_cast<_Float16>(17.0), static_cast<_Float16>(86.0), - static_cast<_Float16>(43.5), static_cast<_Float16>(29.333334), - static_cast<_Float16>(22.25), static_cast<_Float16>(18.0), - static_cast<_Float16>(91.0), static_cast<_Float16>(46.0), - static_cast<_Float16>(31.0), static_cast<_Float16>(23.5), - static_cast<_Float16>(19.0), static_cast<_Float16>(96.0), - static_cast<_Float16>(48.5), static_cast<_Float16>(32.666668), - static_cast<_Float16>(24.75), static_cast<_Float16>(20.0), - static_cast<_Float16>(16.833334), static_cast<_Float16>(14.571428), - static_cast<_Float16>(12.875), static_cast<_Float16>(11.555555), - static_cast<_Float16>(10.5), static_cast<_Float16>(17.666666), - static_cast<_Float16>(15.285714), static_cast<_Float16>(13.5), - static_cast<_Float16>(12.111111), static_cast<_Float16>(11.0), - static_cast<_Float16>(18.5), static_cast<_Float16>(16.0), - static_cast<_Float16>(14.125), static_cast<_Float16>(12.666667), - static_cast<_Float16>(11.5), static_cast<_Float16>(19.333334), - static_cast<_Float16>(16.714285), static_cast<_Float16>(14.75), - static_cast<_Float16>(13.222222), static_cast<_Float16>(12.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(3.5), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.25), static_cast<_FP16>(2.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(4.3333335), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(8.5), static_cast<_FP16>(6.0), + static_cast<_FP16>(4.75), static_cast<_FP16>(4.0), + static_cast<_FP16>(3.5), static_cast<_FP16>(3.142857), + static_cast<_FP16>(2.875), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.5), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(3.857143), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.2222223), static_cast<_FP16>(3.0), + static_cast<_FP16>(5.1666665), static_cast<_FP16>(4.571429), + static_cast<_FP16>(4.125), static_cast<_FP16>(3.7777777), + static_cast<_FP16>(3.5), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.285714), static_cast<_FP16>(4.75), + static_cast<_FP16>(4.3333335), static_cast<_FP16>(4.0), + static_cast<_FP16>(41.0), static_cast<_FP16>(21.0), + static_cast<_FP16>(14.333333), static_cast<_FP16>(11.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(46.0), + static_cast<_FP16>(23.5), static_cast<_FP16>(16.0), + static_cast<_FP16>(12.25), static_cast<_FP16>(10.0), + static_cast<_FP16>(51.0), static_cast<_FP16>(26.0), + static_cast<_FP16>(17.666666), static_cast<_FP16>(13.5), + static_cast<_FP16>(11.0), static_cast<_FP16>(56.0), + static_cast<_FP16>(28.5), static_cast<_FP16>(19.333334), + static_cast<_FP16>(14.75), static_cast<_FP16>(12.0), + static_cast<_FP16>(10.166667), static_cast<_FP16>(8.857142), + static_cast<_FP16>(7.875), static_cast<_FP16>(7.111111), + static_cast<_FP16>(6.5), static_cast<_FP16>(11.0), + static_cast<_FP16>(9.571428), static_cast<_FP16>(8.5), + static_cast<_FP16>(7.6666665), static_cast<_FP16>(7.0), + static_cast<_FP16>(11.833333), static_cast<_FP16>(10.285714), + static_cast<_FP16>(9.125), static_cast<_FP16>(8.222222), + static_cast<_FP16>(7.5), static_cast<_FP16>(12.666667), + static_cast<_FP16>(11.0), static_cast<_FP16>(9.75), + static_cast<_FP16>(8.777778), static_cast<_FP16>(8.0), + static_cast<_FP16>(81.0), static_cast<_FP16>(41.0), + static_cast<_FP16>(27.666666), static_cast<_FP16>(21.0), + static_cast<_FP16>(17.0), static_cast<_FP16>(86.0), + static_cast<_FP16>(43.5), static_cast<_FP16>(29.333334), + static_cast<_FP16>(22.25), static_cast<_FP16>(18.0), + static_cast<_FP16>(91.0), static_cast<_FP16>(46.0), + static_cast<_FP16>(31.0), static_cast<_FP16>(23.5), + static_cast<_FP16>(19.0), static_cast<_FP16>(96.0), + static_cast<_FP16>(48.5), static_cast<_FP16>(32.666668), + static_cast<_FP16>(24.75), static_cast<_FP16>(20.0), + static_cast<_FP16>(16.833334), static_cast<_FP16>(14.571428), + static_cast<_FP16>(12.875), static_cast<_FP16>(11.555555), + static_cast<_FP16>(10.5), static_cast<_FP16>(17.666666), + static_cast<_FP16>(15.285714), static_cast<_FP16>(13.5), + static_cast<_FP16>(12.111111), static_cast<_FP16>(11.0), + static_cast<_FP16>(18.5), static_cast<_FP16>(16.0), + static_cast<_FP16>(14.125), static_cast<_FP16>(12.666667), + static_cast<_FP16>(11.5), static_cast<_FP16>(19.333334), + static_cast<_FP16>(16.714285), static_cast<_FP16>(14.75), + static_cast<_FP16>(13.222222), static_cast<_FP16>(12.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1649,67 +1639,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(3, 1, 4, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(2.0), - static_cast<_Float16>(3.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(3.0), - static_cast<_Float16>(3.5), static_cast<_Float16>(4.0), - static_cast<_Float16>(4.5), static_cast<_Float16>(5.0), - static_cast<_Float16>(3.6666667), static_cast<_Float16>(4.0), - static_cast<_Float16>(4.3333335), static_cast<_Float16>(4.6666665), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(4.25), static_cast<_Float16>(4.5), - static_cast<_Float16>(4.75), static_cast<_Float16>(5.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(22.0), - static_cast<_Float16>(23.0), static_cast<_Float16>(24.0), - static_cast<_Float16>(25.0), static_cast<_Float16>(13.0), - static_cast<_Float16>(13.5), static_cast<_Float16>(14.0), - static_cast<_Float16>(14.5), static_cast<_Float16>(15.0), - static_cast<_Float16>(10.333333), static_cast<_Float16>(10.666667), - static_cast<_Float16>(11.0), static_cast<_Float16>(11.333333), - static_cast<_Float16>(11.666667), static_cast<_Float16>(9.0), - static_cast<_Float16>(9.25), static_cast<_Float16>(9.5), - static_cast<_Float16>(9.75), static_cast<_Float16>(10.0), - static_cast<_Float16>(8.2), static_cast<_Float16>(8.4), - static_cast<_Float16>(8.6), static_cast<_Float16>(8.8), - static_cast<_Float16>(9.0), static_cast<_Float16>(7.6666665), - static_cast<_Float16>(7.8333335), static_cast<_Float16>(8.0), - static_cast<_Float16>(8.166667), static_cast<_Float16>(8.333333), - static_cast<_Float16>(7.285714), static_cast<_Float16>(7.428571), - static_cast<_Float16>(7.571429), static_cast<_Float16>(7.714286), - static_cast<_Float16>(7.857143), static_cast<_Float16>(7.0), - static_cast<_Float16>(7.125), static_cast<_Float16>(7.25), - static_cast<_Float16>(7.375), static_cast<_Float16>(7.5), - static_cast<_Float16>(12.2), static_cast<_Float16>(12.4), - static_cast<_Float16>(12.6), static_cast<_Float16>(12.8), - static_cast<_Float16>(13.0), static_cast<_Float16>(11.0), - static_cast<_Float16>(11.166667), static_cast<_Float16>(11.333333), - static_cast<_Float16>(11.5), static_cast<_Float16>(11.666667), - static_cast<_Float16>(10.142858), static_cast<_Float16>(10.285714), - static_cast<_Float16>(10.428572), static_cast<_Float16>(10.571428), - static_cast<_Float16>(10.714286), static_cast<_Float16>(9.5), - static_cast<_Float16>(9.625), static_cast<_Float16>(9.75), - static_cast<_Float16>(9.875), static_cast<_Float16>(10.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(9.111111), - static_cast<_Float16>(9.222222), static_cast<_Float16>(9.333333), - static_cast<_Float16>(9.444445), static_cast<_Float16>(8.6), - static_cast<_Float16>(8.7), static_cast<_Float16>(8.8), - static_cast<_Float16>(8.9), static_cast<_Float16>(9.0), - static_cast<_Float16>(8.272727), static_cast<_Float16>(8.363636), - static_cast<_Float16>(8.454545), static_cast<_Float16>(8.545455), - static_cast<_Float16>(8.636364), static_cast<_Float16>(8.0), - static_cast<_Float16>(8.083333), static_cast<_Float16>(8.166667), - static_cast<_Float16>(8.25), static_cast<_Float16>(8.333333), - static_cast<_Float16>(11.222222), static_cast<_Float16>(11.333333), - static_cast<_Float16>(11.444445), static_cast<_Float16>(11.555555), - static_cast<_Float16>(11.666667), static_cast<_Float16>(10.6), - static_cast<_Float16>(10.7), static_cast<_Float16>(10.8), - static_cast<_Float16>(10.9), static_cast<_Float16>(11.0), - static_cast<_Float16>(10.090909), static_cast<_Float16>(10.181818), - static_cast<_Float16>(10.272727), static_cast<_Float16>(10.363636), - static_cast<_Float16>(10.454545), static_cast<_Float16>(9.666667), - static_cast<_Float16>(9.75), static_cast<_Float16>(9.833333), - static_cast<_Float16>(9.916667), static_cast<_Float16>(10.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(2.0), + static_cast<_FP16>(3.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(3.0), + static_cast<_FP16>(3.5), static_cast<_FP16>(4.0), + static_cast<_FP16>(4.5), static_cast<_FP16>(5.0), + static_cast<_FP16>(3.6666667), static_cast<_FP16>(4.0), + static_cast<_FP16>(4.3333335), static_cast<_FP16>(4.6666665), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(4.25), static_cast<_FP16>(4.5), + static_cast<_FP16>(4.75), static_cast<_FP16>(5.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(22.0), + static_cast<_FP16>(23.0), static_cast<_FP16>(24.0), + static_cast<_FP16>(25.0), static_cast<_FP16>(13.0), + static_cast<_FP16>(13.5), static_cast<_FP16>(14.0), + static_cast<_FP16>(14.5), static_cast<_FP16>(15.0), + static_cast<_FP16>(10.333333), static_cast<_FP16>(10.666667), + static_cast<_FP16>(11.0), static_cast<_FP16>(11.333333), + static_cast<_FP16>(11.666667), static_cast<_FP16>(9.0), + static_cast<_FP16>(9.25), static_cast<_FP16>(9.5), + static_cast<_FP16>(9.75), static_cast<_FP16>(10.0), + static_cast<_FP16>(8.2), static_cast<_FP16>(8.4), + static_cast<_FP16>(8.6), static_cast<_FP16>(8.8), + static_cast<_FP16>(9.0), static_cast<_FP16>(7.6666665), + static_cast<_FP16>(7.8333335), static_cast<_FP16>(8.0), + static_cast<_FP16>(8.166667), static_cast<_FP16>(8.333333), + static_cast<_FP16>(7.285714), static_cast<_FP16>(7.428571), + static_cast<_FP16>(7.571429), static_cast<_FP16>(7.714286), + static_cast<_FP16>(7.857143), static_cast<_FP16>(7.0), + static_cast<_FP16>(7.125), static_cast<_FP16>(7.25), + static_cast<_FP16>(7.375), static_cast<_FP16>(7.5), + static_cast<_FP16>(12.2), static_cast<_FP16>(12.4), + static_cast<_FP16>(12.6), static_cast<_FP16>(12.8), + static_cast<_FP16>(13.0), static_cast<_FP16>(11.0), + static_cast<_FP16>(11.166667), static_cast<_FP16>(11.333333), + static_cast<_FP16>(11.5), static_cast<_FP16>(11.666667), + static_cast<_FP16>(10.142858), static_cast<_FP16>(10.285714), + static_cast<_FP16>(10.428572), static_cast<_FP16>(10.571428), + static_cast<_FP16>(10.714286), static_cast<_FP16>(9.5), + static_cast<_FP16>(9.625), static_cast<_FP16>(9.75), + static_cast<_FP16>(9.875), static_cast<_FP16>(10.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(9.111111), + static_cast<_FP16>(9.222222), static_cast<_FP16>(9.333333), + static_cast<_FP16>(9.444445), static_cast<_FP16>(8.6), + static_cast<_FP16>(8.7), static_cast<_FP16>(8.8), + static_cast<_FP16>(8.9), static_cast<_FP16>(9.0), + static_cast<_FP16>(8.272727), static_cast<_FP16>(8.363636), + static_cast<_FP16>(8.454545), static_cast<_FP16>(8.545455), + static_cast<_FP16>(8.636364), static_cast<_FP16>(8.0), + static_cast<_FP16>(8.083333), static_cast<_FP16>(8.166667), + static_cast<_FP16>(8.25), static_cast<_FP16>(8.333333), + static_cast<_FP16>(11.222222), static_cast<_FP16>(11.333333), + static_cast<_FP16>(11.444445), static_cast<_FP16>(11.555555), + static_cast<_FP16>(11.666667), static_cast<_FP16>(10.6), + static_cast<_FP16>(10.7), static_cast<_FP16>(10.8), + static_cast<_FP16>(10.9), static_cast<_FP16>(11.0), + static_cast<_FP16>(10.090909), static_cast<_FP16>(10.181818), + static_cast<_FP16>(10.272727), static_cast<_FP16>(10.363636), + static_cast<_FP16>(10.454545), static_cast<_FP16>(9.666667), + static_cast<_FP16>(9.75), static_cast<_FP16>(9.833333), + static_cast<_FP16>(9.916667), static_cast<_FP16>(10.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1724,67 +1714,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(1, 1, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(3.5), static_cast<_Float16>(2.6666667), - static_cast<_Float16>(2.25), static_cast<_Float16>(2.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(4.3333335), static_cast<_Float16>(3.5), - static_cast<_Float16>(3.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(8.5), static_cast<_Float16>(6.0), - static_cast<_Float16>(4.75), static_cast<_Float16>(4.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(11.0), - static_cast<_Float16>(7.6666665), static_cast<_Float16>(6.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(26.0), - static_cast<_Float16>(13.5), static_cast<_Float16>(9.333333), - static_cast<_Float16>(7.25), static_cast<_Float16>(6.0), - static_cast<_Float16>(31.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(8.5), - static_cast<_Float16>(7.0), static_cast<_Float16>(36.0), - static_cast<_Float16>(18.5), static_cast<_Float16>(12.666667), - static_cast<_Float16>(9.75), static_cast<_Float16>(8.0), - static_cast<_Float16>(41.0), static_cast<_Float16>(21.0), - static_cast<_Float16>(14.333333), static_cast<_Float16>(11.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(46.0), - static_cast<_Float16>(23.5), static_cast<_Float16>(16.0), - static_cast<_Float16>(12.25), static_cast<_Float16>(10.0), - static_cast<_Float16>(51.0), static_cast<_Float16>(26.0), - static_cast<_Float16>(17.666666), static_cast<_Float16>(13.5), - static_cast<_Float16>(11.0), static_cast<_Float16>(56.0), - static_cast<_Float16>(28.5), static_cast<_Float16>(19.333334), - static_cast<_Float16>(14.75), static_cast<_Float16>(12.0), - static_cast<_Float16>(61.0), static_cast<_Float16>(31.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(13.0), static_cast<_Float16>(66.0), - static_cast<_Float16>(33.5), static_cast<_Float16>(22.666666), - static_cast<_Float16>(17.25), static_cast<_Float16>(14.0), - static_cast<_Float16>(71.0), static_cast<_Float16>(36.0), - static_cast<_Float16>(24.333334), static_cast<_Float16>(18.5), - static_cast<_Float16>(15.0), static_cast<_Float16>(76.0), - static_cast<_Float16>(38.5), static_cast<_Float16>(26.0), - static_cast<_Float16>(19.75), static_cast<_Float16>(16.0), - static_cast<_Float16>(81.0), static_cast<_Float16>(41.0), - static_cast<_Float16>(27.666666), static_cast<_Float16>(21.0), - static_cast<_Float16>(17.0), static_cast<_Float16>(86.0), - static_cast<_Float16>(43.5), static_cast<_Float16>(29.333334), - static_cast<_Float16>(22.25), static_cast<_Float16>(18.0), - static_cast<_Float16>(91.0), static_cast<_Float16>(46.0), - static_cast<_Float16>(31.0), static_cast<_Float16>(23.5), - static_cast<_Float16>(19.0), static_cast<_Float16>(96.0), - static_cast<_Float16>(48.5), static_cast<_Float16>(32.666668), - static_cast<_Float16>(24.75), static_cast<_Float16>(20.0), - static_cast<_Float16>(101.0), static_cast<_Float16>(51.0), - static_cast<_Float16>(34.333332), static_cast<_Float16>(26.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(106.0), - static_cast<_Float16>(53.5), static_cast<_Float16>(36.0), - static_cast<_Float16>(27.25), static_cast<_Float16>(22.0), - static_cast<_Float16>(111.0), static_cast<_Float16>(56.0), - static_cast<_Float16>(37.666668), static_cast<_Float16>(28.5), - static_cast<_Float16>(23.0), static_cast<_Float16>(116.0), - static_cast<_Float16>(58.5), static_cast<_Float16>(39.333332), - static_cast<_Float16>(29.75), static_cast<_Float16>(24.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(3.5), static_cast<_FP16>(2.6666667), + static_cast<_FP16>(2.25), static_cast<_FP16>(2.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(4.3333335), static_cast<_FP16>(3.5), + static_cast<_FP16>(3.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(8.5), static_cast<_FP16>(6.0), + static_cast<_FP16>(4.75), static_cast<_FP16>(4.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(11.0), + static_cast<_FP16>(7.6666665), static_cast<_FP16>(6.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(26.0), + static_cast<_FP16>(13.5), static_cast<_FP16>(9.333333), + static_cast<_FP16>(7.25), static_cast<_FP16>(6.0), + static_cast<_FP16>(31.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(8.5), + static_cast<_FP16>(7.0), static_cast<_FP16>(36.0), + static_cast<_FP16>(18.5), static_cast<_FP16>(12.666667), + static_cast<_FP16>(9.75), static_cast<_FP16>(8.0), + static_cast<_FP16>(41.0), static_cast<_FP16>(21.0), + static_cast<_FP16>(14.333333), static_cast<_FP16>(11.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(46.0), + static_cast<_FP16>(23.5), static_cast<_FP16>(16.0), + static_cast<_FP16>(12.25), static_cast<_FP16>(10.0), + static_cast<_FP16>(51.0), static_cast<_FP16>(26.0), + static_cast<_FP16>(17.666666), static_cast<_FP16>(13.5), + static_cast<_FP16>(11.0), static_cast<_FP16>(56.0), + static_cast<_FP16>(28.5), static_cast<_FP16>(19.333334), + static_cast<_FP16>(14.75), static_cast<_FP16>(12.0), + static_cast<_FP16>(61.0), static_cast<_FP16>(31.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(13.0), static_cast<_FP16>(66.0), + static_cast<_FP16>(33.5), static_cast<_FP16>(22.666666), + static_cast<_FP16>(17.25), static_cast<_FP16>(14.0), + static_cast<_FP16>(71.0), static_cast<_FP16>(36.0), + static_cast<_FP16>(24.333334), static_cast<_FP16>(18.5), + static_cast<_FP16>(15.0), static_cast<_FP16>(76.0), + static_cast<_FP16>(38.5), static_cast<_FP16>(26.0), + static_cast<_FP16>(19.75), static_cast<_FP16>(16.0), + static_cast<_FP16>(81.0), static_cast<_FP16>(41.0), + static_cast<_FP16>(27.666666), static_cast<_FP16>(21.0), + static_cast<_FP16>(17.0), static_cast<_FP16>(86.0), + static_cast<_FP16>(43.5), static_cast<_FP16>(29.333334), + static_cast<_FP16>(22.25), static_cast<_FP16>(18.0), + static_cast<_FP16>(91.0), static_cast<_FP16>(46.0), + static_cast<_FP16>(31.0), static_cast<_FP16>(23.5), + static_cast<_FP16>(19.0), static_cast<_FP16>(96.0), + static_cast<_FP16>(48.5), static_cast<_FP16>(32.666668), + static_cast<_FP16>(24.75), static_cast<_FP16>(20.0), + static_cast<_FP16>(101.0), static_cast<_FP16>(51.0), + static_cast<_FP16>(34.333332), static_cast<_FP16>(26.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(106.0), + static_cast<_FP16>(53.5), static_cast<_FP16>(36.0), + static_cast<_FP16>(27.25), static_cast<_FP16>(22.0), + static_cast<_FP16>(111.0), static_cast<_FP16>(56.0), + static_cast<_FP16>(37.666668), static_cast<_FP16>(28.5), + static_cast<_FP16>(23.0), static_cast<_FP16>(116.0), + static_cast<_FP16>(58.5), static_cast<_FP16>(39.333332), + static_cast<_FP16>(29.75), static_cast<_FP16>(24.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1799,67 +1789,66 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(1, 2, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(2.0), - static_cast<_Float16>(3.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(7.0), static_cast<_Float16>(8.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(10.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(12.0), - static_cast<_Float16>(13.0), static_cast<_Float16>(14.0), - static_cast<_Float16>(15.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(17.0), static_cast<_Float16>(18.0), - static_cast<_Float16>(19.0), static_cast<_Float16>(20.0), - static_cast<_Float16>(10.5), static_cast<_Float16>(11.0), - static_cast<_Float16>(11.5), static_cast<_Float16>(12.0), - static_cast<_Float16>(12.5), static_cast<_Float16>(13.0), - static_cast<_Float16>(13.5), static_cast<_Float16>(14.0), - static_cast<_Float16>(14.5), static_cast<_Float16>(15.0), - static_cast<_Float16>(15.5), static_cast<_Float16>(16.0), - static_cast<_Float16>(16.5), static_cast<_Float16>(17.0), - static_cast<_Float16>(17.5), static_cast<_Float16>(18.0), - static_cast<_Float16>(18.5), static_cast<_Float16>(19.0), - static_cast<_Float16>(19.5), static_cast<_Float16>(20.0), - static_cast<_Float16>(41.0), static_cast<_Float16>(42.0), - static_cast<_Float16>(43.0), static_cast<_Float16>(44.0), - static_cast<_Float16>(45.0), static_cast<_Float16>(46.0), - static_cast<_Float16>(47.0), static_cast<_Float16>(48.0), - static_cast<_Float16>(49.0), static_cast<_Float16>(50.0), - static_cast<_Float16>(51.0), static_cast<_Float16>(52.0), - static_cast<_Float16>(53.0), static_cast<_Float16>(54.0), - static_cast<_Float16>(55.0), static_cast<_Float16>(56.0), - static_cast<_Float16>(57.0), static_cast<_Float16>(58.0), - static_cast<_Float16>(59.0), static_cast<_Float16>(60.0), - static_cast<_Float16>(30.5), static_cast<_Float16>(31.0), - static_cast<_Float16>(31.5), static_cast<_Float16>(32.0), - static_cast<_Float16>(32.5), static_cast<_Float16>(33.0), - static_cast<_Float16>(33.5), static_cast<_Float16>(34.0), - static_cast<_Float16>(34.5), static_cast<_Float16>(35.0), - static_cast<_Float16>(35.5), static_cast<_Float16>(36.0), - static_cast<_Float16>(36.5), static_cast<_Float16>(37.0), - static_cast<_Float16>(37.5), static_cast<_Float16>(38.0), - static_cast<_Float16>(38.5), static_cast<_Float16>(39.0), - static_cast<_Float16>(39.5), static_cast<_Float16>(40.0), - static_cast<_Float16>(81.0), static_cast<_Float16>(82.0), - static_cast<_Float16>(83.0), static_cast<_Float16>(84.0), - static_cast<_Float16>(85.0), static_cast<_Float16>(86.0), - static_cast<_Float16>(87.0), static_cast<_Float16>(88.0), - static_cast<_Float16>(89.0), static_cast<_Float16>(90.0), - static_cast<_Float16>(91.0), static_cast<_Float16>(92.0), - static_cast<_Float16>(93.0), static_cast<_Float16>(94.0), - static_cast<_Float16>(95.0), static_cast<_Float16>(96.0), - static_cast<_Float16>(97.0), static_cast<_Float16>(98.0), - static_cast<_Float16>(99.0), static_cast<_Float16>(100.0), - static_cast<_Float16>(50.5), static_cast<_Float16>(51.0), - static_cast<_Float16>(51.5), static_cast<_Float16>(52.0), - static_cast<_Float16>(52.5), static_cast<_Float16>(53.0), - static_cast<_Float16>(53.5), static_cast<_Float16>(54.0), - static_cast<_Float16>(54.5), static_cast<_Float16>(55.0), - static_cast<_Float16>(55.5), static_cast<_Float16>(56.0), - static_cast<_Float16>(56.5), static_cast<_Float16>(57.0), - static_cast<_Float16>(57.5), static_cast<_Float16>(58.0), - static_cast<_Float16>(58.5), static_cast<_Float16>(59.0), - static_cast<_Float16>(59.5), static_cast<_Float16>(60.0)}; + _FP16 answer_data[] = {static_cast<_FP16>(1.0), static_cast<_FP16>(2.0), + static_cast<_FP16>(3.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(7.0), static_cast<_FP16>(8.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(10.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(12.0), + static_cast<_FP16>(13.0), static_cast<_FP16>(14.0), + static_cast<_FP16>(15.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(17.0), static_cast<_FP16>(18.0), + static_cast<_FP16>(19.0), static_cast<_FP16>(20.0), + static_cast<_FP16>(10.5), static_cast<_FP16>(11.0), + static_cast<_FP16>(11.5), static_cast<_FP16>(12.0), + static_cast<_FP16>(12.5), static_cast<_FP16>(13.0), + static_cast<_FP16>(13.5), static_cast<_FP16>(14.0), + static_cast<_FP16>(14.5), static_cast<_FP16>(15.0), + static_cast<_FP16>(15.5), static_cast<_FP16>(16.0), + static_cast<_FP16>(16.5), static_cast<_FP16>(17.0), + static_cast<_FP16>(17.5), static_cast<_FP16>(18.0), + static_cast<_FP16>(18.5), static_cast<_FP16>(19.0), + static_cast<_FP16>(19.5), static_cast<_FP16>(20.0), + static_cast<_FP16>(41.0), static_cast<_FP16>(42.0), + static_cast<_FP16>(43.0), static_cast<_FP16>(44.0), + static_cast<_FP16>(45.0), static_cast<_FP16>(46.0), + static_cast<_FP16>(47.0), static_cast<_FP16>(48.0), + static_cast<_FP16>(49.0), static_cast<_FP16>(50.0), + static_cast<_FP16>(51.0), static_cast<_FP16>(52.0), + static_cast<_FP16>(53.0), static_cast<_FP16>(54.0), + static_cast<_FP16>(55.0), static_cast<_FP16>(56.0), + static_cast<_FP16>(57.0), static_cast<_FP16>(58.0), + static_cast<_FP16>(59.0), static_cast<_FP16>(60.0), + static_cast<_FP16>(30.5), static_cast<_FP16>(31.0), + static_cast<_FP16>(31.5), static_cast<_FP16>(32.0), + static_cast<_FP16>(32.5), static_cast<_FP16>(33.0), + static_cast<_FP16>(33.5), static_cast<_FP16>(34.0), + static_cast<_FP16>(34.5), static_cast<_FP16>(35.0), + static_cast<_FP16>(35.5), static_cast<_FP16>(36.0), + static_cast<_FP16>(36.5), static_cast<_FP16>(37.0), + static_cast<_FP16>(37.5), static_cast<_FP16>(38.0), + static_cast<_FP16>(38.5), static_cast<_FP16>(39.0), + static_cast<_FP16>(39.5), static_cast<_FP16>(40.0), + static_cast<_FP16>(81.0), static_cast<_FP16>(82.0), + static_cast<_FP16>(83.0), static_cast<_FP16>(84.0), + static_cast<_FP16>(85.0), static_cast<_FP16>(86.0), + static_cast<_FP16>(87.0), static_cast<_FP16>(88.0), + static_cast<_FP16>(89.0), static_cast<_FP16>(90.0), + static_cast<_FP16>(91.0), static_cast<_FP16>(92.0), + static_cast<_FP16>(93.0), static_cast<_FP16>(94.0), + static_cast<_FP16>(95.0), static_cast<_FP16>(96.0), + static_cast<_FP16>(97.0), static_cast<_FP16>(98.0), + static_cast<_FP16>(99.0), static_cast<_FP16>(100.0), + static_cast<_FP16>(50.5), static_cast<_FP16>(51.0), + static_cast<_FP16>(51.5), static_cast<_FP16>(52.0), + static_cast<_FP16>(52.5), static_cast<_FP16>(53.0), + static_cast<_FP16>(53.5), static_cast<_FP16>(54.0), + static_cast<_FP16>(54.5), static_cast<_FP16>(55.0), + static_cast<_FP16>(55.5), static_cast<_FP16>(56.0), + static_cast<_FP16>(56.5), static_cast<_FP16>(57.0), + static_cast<_FP16>(57.5), static_cast<_FP16>(58.0), + static_cast<_FP16>(58.5), static_cast<_FP16>(59.0), + static_cast<_FP16>(59.5), static_cast<_FP16>(60.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1874,67 +1863,67 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(3, 1, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(2.0), - static_cast<_Float16>(3.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(6.0), - static_cast<_Float16>(7.0), static_cast<_Float16>(8.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(10.0), - static_cast<_Float16>(11.0), static_cast<_Float16>(12.0), - static_cast<_Float16>(13.0), static_cast<_Float16>(14.0), - static_cast<_Float16>(15.0), static_cast<_Float16>(16.0), - static_cast<_Float16>(17.0), static_cast<_Float16>(18.0), - static_cast<_Float16>(19.0), static_cast<_Float16>(20.0), - static_cast<_Float16>(21.0), static_cast<_Float16>(22.0), - static_cast<_Float16>(23.0), static_cast<_Float16>(24.0), - static_cast<_Float16>(25.0), static_cast<_Float16>(26.0), - static_cast<_Float16>(27.0), static_cast<_Float16>(28.0), - static_cast<_Float16>(29.0), static_cast<_Float16>(30.0), - static_cast<_Float16>(31.0), static_cast<_Float16>(32.0), - static_cast<_Float16>(33.0), static_cast<_Float16>(34.0), - static_cast<_Float16>(35.0), static_cast<_Float16>(36.0), - static_cast<_Float16>(37.0), static_cast<_Float16>(38.0), - static_cast<_Float16>(39.0), static_cast<_Float16>(40.0), - static_cast<_Float16>(20.5), static_cast<_Float16>(21.0), - static_cast<_Float16>(21.5), static_cast<_Float16>(22.0), - static_cast<_Float16>(22.5), static_cast<_Float16>(23.0), - static_cast<_Float16>(23.5), static_cast<_Float16>(24.0), - static_cast<_Float16>(24.5), static_cast<_Float16>(25.0), - static_cast<_Float16>(25.5), static_cast<_Float16>(26.0), - static_cast<_Float16>(26.5), static_cast<_Float16>(27.0), - static_cast<_Float16>(27.5), static_cast<_Float16>(28.0), - static_cast<_Float16>(28.5), static_cast<_Float16>(29.0), - static_cast<_Float16>(29.5), static_cast<_Float16>(30.0), - static_cast<_Float16>(30.5), static_cast<_Float16>(31.0), - static_cast<_Float16>(31.5), static_cast<_Float16>(32.0), - static_cast<_Float16>(32.5), static_cast<_Float16>(33.0), - static_cast<_Float16>(33.5), static_cast<_Float16>(34.0), - static_cast<_Float16>(34.5), static_cast<_Float16>(35.0), - static_cast<_Float16>(35.5), static_cast<_Float16>(36.0), - static_cast<_Float16>(36.5), static_cast<_Float16>(37.0), - static_cast<_Float16>(37.5), static_cast<_Float16>(38.0), - static_cast<_Float16>(38.5), static_cast<_Float16>(39.0), - static_cast<_Float16>(39.5), static_cast<_Float16>(40.0), - static_cast<_Float16>(27.0), static_cast<_Float16>(27.333334), - static_cast<_Float16>(27.666666), static_cast<_Float16>(28.0), - static_cast<_Float16>(28.333334), static_cast<_Float16>(28.666666), - static_cast<_Float16>(29.0), static_cast<_Float16>(29.333334), - static_cast<_Float16>(29.666666), static_cast<_Float16>(30.0), - static_cast<_Float16>(30.333334), static_cast<_Float16>(30.666666), - static_cast<_Float16>(31.0), static_cast<_Float16>(31.333334), - static_cast<_Float16>(31.666666), static_cast<_Float16>(32.0), - static_cast<_Float16>(32.333332), static_cast<_Float16>(32.666668), - static_cast<_Float16>(33.0), static_cast<_Float16>(33.333332), - static_cast<_Float16>(33.666668), static_cast<_Float16>(34.0), - static_cast<_Float16>(34.333332), static_cast<_Float16>(34.666668), - static_cast<_Float16>(35.0), static_cast<_Float16>(35.333332), - static_cast<_Float16>(35.666668), static_cast<_Float16>(36.0), - static_cast<_Float16>(36.333332), static_cast<_Float16>(36.666668), - static_cast<_Float16>(37.0), static_cast<_Float16>(37.333332), - static_cast<_Float16>(37.666668), static_cast<_Float16>(38.0), - static_cast<_Float16>(38.333332), static_cast<_Float16>(38.666668), - static_cast<_Float16>(39.0), static_cast<_Float16>(39.333332), - static_cast<_Float16>(39.666668), static_cast<_Float16>(40.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(2.0), + static_cast<_FP16>(3.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(6.0), + static_cast<_FP16>(7.0), static_cast<_FP16>(8.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(10.0), + static_cast<_FP16>(11.0), static_cast<_FP16>(12.0), + static_cast<_FP16>(13.0), static_cast<_FP16>(14.0), + static_cast<_FP16>(15.0), static_cast<_FP16>(16.0), + static_cast<_FP16>(17.0), static_cast<_FP16>(18.0), + static_cast<_FP16>(19.0), static_cast<_FP16>(20.0), + static_cast<_FP16>(21.0), static_cast<_FP16>(22.0), + static_cast<_FP16>(23.0), static_cast<_FP16>(24.0), + static_cast<_FP16>(25.0), static_cast<_FP16>(26.0), + static_cast<_FP16>(27.0), static_cast<_FP16>(28.0), + static_cast<_FP16>(29.0), static_cast<_FP16>(30.0), + static_cast<_FP16>(31.0), static_cast<_FP16>(32.0), + static_cast<_FP16>(33.0), static_cast<_FP16>(34.0), + static_cast<_FP16>(35.0), static_cast<_FP16>(36.0), + static_cast<_FP16>(37.0), static_cast<_FP16>(38.0), + static_cast<_FP16>(39.0), static_cast<_FP16>(40.0), + static_cast<_FP16>(20.5), static_cast<_FP16>(21.0), + static_cast<_FP16>(21.5), static_cast<_FP16>(22.0), + static_cast<_FP16>(22.5), static_cast<_FP16>(23.0), + static_cast<_FP16>(23.5), static_cast<_FP16>(24.0), + static_cast<_FP16>(24.5), static_cast<_FP16>(25.0), + static_cast<_FP16>(25.5), static_cast<_FP16>(26.0), + static_cast<_FP16>(26.5), static_cast<_FP16>(27.0), + static_cast<_FP16>(27.5), static_cast<_FP16>(28.0), + static_cast<_FP16>(28.5), static_cast<_FP16>(29.0), + static_cast<_FP16>(29.5), static_cast<_FP16>(30.0), + static_cast<_FP16>(30.5), static_cast<_FP16>(31.0), + static_cast<_FP16>(31.5), static_cast<_FP16>(32.0), + static_cast<_FP16>(32.5), static_cast<_FP16>(33.0), + static_cast<_FP16>(33.5), static_cast<_FP16>(34.0), + static_cast<_FP16>(34.5), static_cast<_FP16>(35.0), + static_cast<_FP16>(35.5), static_cast<_FP16>(36.0), + static_cast<_FP16>(36.5), static_cast<_FP16>(37.0), + static_cast<_FP16>(37.5), static_cast<_FP16>(38.0), + static_cast<_FP16>(38.5), static_cast<_FP16>(39.0), + static_cast<_FP16>(39.5), static_cast<_FP16>(40.0), + static_cast<_FP16>(27.0), static_cast<_FP16>(27.333334), + static_cast<_FP16>(27.666666), static_cast<_FP16>(28.0), + static_cast<_FP16>(28.333334), static_cast<_FP16>(28.666666), + static_cast<_FP16>(29.0), static_cast<_FP16>(29.333334), + static_cast<_FP16>(29.666666), static_cast<_FP16>(30.0), + static_cast<_FP16>(30.333334), static_cast<_FP16>(30.666666), + static_cast<_FP16>(31.0), static_cast<_FP16>(31.333334), + static_cast<_FP16>(31.666666), static_cast<_FP16>(32.0), + static_cast<_FP16>(32.333332), static_cast<_FP16>(32.666668), + static_cast<_FP16>(33.0), static_cast<_FP16>(33.333332), + static_cast<_FP16>(33.666668), static_cast<_FP16>(34.0), + static_cast<_FP16>(34.333332), static_cast<_FP16>(34.666668), + static_cast<_FP16>(35.0), static_cast<_FP16>(35.333332), + static_cast<_FP16>(35.666668), static_cast<_FP16>(36.0), + static_cast<_FP16>(36.333332), static_cast<_FP16>(36.666668), + static_cast<_FP16>(37.0), static_cast<_FP16>(37.333332), + static_cast<_FP16>(37.666668), static_cast<_FP16>(38.0), + static_cast<_FP16>(38.333332), static_cast<_FP16>(38.666668), + static_cast<_FP16>(39.0), static_cast<_FP16>(39.333332), + static_cast<_FP16>(39.666668), static_cast<_FP16>(40.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -1949,37 +1938,37 @@ TEST(nntrainer_Tensor, divide_i_broadcast_01_p) { nntrainer::Tensor m = ranged(3, 1, 1, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1); - _Float16 answer_data[] = { - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(1.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(3.0), - static_cast<_Float16>(2.3333333), static_cast<_Float16>(2.0), - static_cast<_Float16>(9.0), static_cast<_Float16>(5.0), - static_cast<_Float16>(3.6666667), static_cast<_Float16>(3.0), - static_cast<_Float16>(13.0), static_cast<_Float16>(7.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.0), - static_cast<_Float16>(17.0), static_cast<_Float16>(9.0), - static_cast<_Float16>(6.3333335), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.2), static_cast<_Float16>(3.6666667), - static_cast<_Float16>(3.2857144), static_cast<_Float16>(3.0), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(3.857143), static_cast<_Float16>(3.5), - static_cast<_Float16>(5.8), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.428571), static_cast<_Float16>(4.0), - static_cast<_Float16>(6.6), static_cast<_Float16>(5.6666665), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.5), - static_cast<_Float16>(7.4), static_cast<_Float16>(6.3333335), - static_cast<_Float16>(5.571429), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.5555553), static_cast<_Float16>(4.2), - static_cast<_Float16>(3.909091), static_cast<_Float16>(3.6666667), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.6), - static_cast<_Float16>(4.2727275), static_cast<_Float16>(4.0), - static_cast<_Float16>(5.4444447), static_cast<_Float16>(5.0), - static_cast<_Float16>(4.6363635), static_cast<_Float16>(4.3333335), - static_cast<_Float16>(5.888889), static_cast<_Float16>(5.4), - static_cast<_Float16>(5.0), static_cast<_Float16>(4.6666665), - static_cast<_Float16>(6.3333335), static_cast<_Float16>(5.8), - static_cast<_Float16>(5.3636365), static_cast<_Float16>(5.0)}; + _FP16 answer_data[] = { + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(1.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(3.0), + static_cast<_FP16>(2.3333333), static_cast<_FP16>(2.0), + static_cast<_FP16>(9.0), static_cast<_FP16>(5.0), + static_cast<_FP16>(3.6666667), static_cast<_FP16>(3.0), + static_cast<_FP16>(13.0), static_cast<_FP16>(7.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.0), + static_cast<_FP16>(17.0), static_cast<_FP16>(9.0), + static_cast<_FP16>(6.3333335), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.2), static_cast<_FP16>(3.6666667), + static_cast<_FP16>(3.2857144), static_cast<_FP16>(3.0), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(3.857143), static_cast<_FP16>(3.5), + static_cast<_FP16>(5.8), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.428571), static_cast<_FP16>(4.0), + static_cast<_FP16>(6.6), static_cast<_FP16>(5.6666665), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.5), + static_cast<_FP16>(7.4), static_cast<_FP16>(6.3333335), + static_cast<_FP16>(5.571429), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.5555553), static_cast<_FP16>(4.2), + static_cast<_FP16>(3.909091), static_cast<_FP16>(3.6666667), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.6), + static_cast<_FP16>(4.2727275), static_cast<_FP16>(4.0), + static_cast<_FP16>(5.4444447), static_cast<_FP16>(5.0), + static_cast<_FP16>(4.6363635), static_cast<_FP16>(4.3333335), + static_cast<_FP16>(5.888889), static_cast<_FP16>(5.4), + static_cast<_FP16>(5.0), static_cast<_FP16>(4.6666665), + static_cast<_FP16>(6.3333335), static_cast<_FP16>(5.8), + static_cast<_FP16>(5.3636365), static_cast<_FP16>(5.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.divide_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2022,16 +2011,16 @@ TEST(nntrainer_Tensor, add_i_01_p) { nntrainer::Tdatatype::FP16); original.copy(target); - status = target.add_i((_Float16)2.1); + status = target.add_i((_FP16)2.1); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *previous = original.getData<_Float16>(); + _FP16 *previous = original.getData<_FP16>(); ASSERT_NE(nullptr, previous); - _Float16 *data = target.getData<_Float16>(); + _FP16 *data = target.getData<_FP16>(); ASSERT_NE(nullptr, data); for (int i = 0; i < batch * height * width; ++i) { - EXPECT_FLOAT_EQ(data[i], (_Float16)(previous[i] + (_Float16)2.1)); + EXPECT_FLOAT_EQ(data[i], (_FP16)(previous[i] + (_FP16)2.1)); } } @@ -2054,9 +2043,9 @@ TEST(nntrainer_Tensor, add_i_02_p) { status = target.add_i(target, 3.0); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *previous = original.getData<_Float16>(); + _FP16 *previous = original.getData<_FP16>(); ASSERT_NE(nullptr, previous); - _Float16 *data = target.getData<_Float16>(); + _FP16 *data = target.getData<_FP16>(); ASSERT_NE(nullptr, data); for (int i = 0; i < batch * height * width; ++i) { @@ -2095,67 +2084,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(2), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(8), static_cast<_Float16>(10), - static_cast<_Float16>(12), static_cast<_Float16>(14), - static_cast<_Float16>(16), static_cast<_Float16>(18), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(30), - static_cast<_Float16>(32), static_cast<_Float16>(34), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(50), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(56), static_cast<_Float16>(58), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(68), static_cast<_Float16>(70), - static_cast<_Float16>(72), static_cast<_Float16>(74), - static_cast<_Float16>(76), static_cast<_Float16>(78), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(50), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(56), static_cast<_Float16>(58), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(68), static_cast<_Float16>(70), - static_cast<_Float16>(72), static_cast<_Float16>(74), - static_cast<_Float16>(76), static_cast<_Float16>(78), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(90), - static_cast<_Float16>(92), static_cast<_Float16>(94), - static_cast<_Float16>(96), static_cast<_Float16>(98), - static_cast<_Float16>(100), static_cast<_Float16>(102), - static_cast<_Float16>(104), static_cast<_Float16>(106), - static_cast<_Float16>(108), static_cast<_Float16>(110), - static_cast<_Float16>(112), static_cast<_Float16>(114), - static_cast<_Float16>(116), static_cast<_Float16>(118), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(90), - static_cast<_Float16>(92), static_cast<_Float16>(94), - static_cast<_Float16>(96), static_cast<_Float16>(98), - static_cast<_Float16>(100), static_cast<_Float16>(102), - static_cast<_Float16>(104), static_cast<_Float16>(106), - static_cast<_Float16>(108), static_cast<_Float16>(110), - static_cast<_Float16>(112), static_cast<_Float16>(114), - static_cast<_Float16>(116), static_cast<_Float16>(118), - static_cast<_Float16>(120), static_cast<_Float16>(122), - static_cast<_Float16>(124), static_cast<_Float16>(126), - static_cast<_Float16>(128), static_cast<_Float16>(130), - static_cast<_Float16>(132), static_cast<_Float16>(134), - static_cast<_Float16>(136), static_cast<_Float16>(138), - static_cast<_Float16>(140), static_cast<_Float16>(142), - static_cast<_Float16>(144), static_cast<_Float16>(146), - static_cast<_Float16>(148), static_cast<_Float16>(150), - static_cast<_Float16>(152), static_cast<_Float16>(154), - static_cast<_Float16>(156), static_cast<_Float16>(158)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(2), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(8), static_cast<_FP16>(10), + static_cast<_FP16>(12), static_cast<_FP16>(14), + static_cast<_FP16>(16), static_cast<_FP16>(18), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(30), + static_cast<_FP16>(32), static_cast<_FP16>(34), + static_cast<_FP16>(36), static_cast<_FP16>(38), + static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(44), static_cast<_FP16>(46), + static_cast<_FP16>(48), static_cast<_FP16>(50), + static_cast<_FP16>(52), static_cast<_FP16>(54), + static_cast<_FP16>(56), static_cast<_FP16>(58), + static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(64), static_cast<_FP16>(66), + static_cast<_FP16>(68), static_cast<_FP16>(70), + static_cast<_FP16>(72), static_cast<_FP16>(74), + static_cast<_FP16>(76), static_cast<_FP16>(78), + static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(44), static_cast<_FP16>(46), + static_cast<_FP16>(48), static_cast<_FP16>(50), + static_cast<_FP16>(52), static_cast<_FP16>(54), + static_cast<_FP16>(56), static_cast<_FP16>(58), + static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(64), static_cast<_FP16>(66), + static_cast<_FP16>(68), static_cast<_FP16>(70), + static_cast<_FP16>(72), static_cast<_FP16>(74), + static_cast<_FP16>(76), static_cast<_FP16>(78), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(90), + static_cast<_FP16>(92), static_cast<_FP16>(94), + static_cast<_FP16>(96), static_cast<_FP16>(98), + static_cast<_FP16>(100), static_cast<_FP16>(102), + static_cast<_FP16>(104), static_cast<_FP16>(106), + static_cast<_FP16>(108), static_cast<_FP16>(110), + static_cast<_FP16>(112), static_cast<_FP16>(114), + static_cast<_FP16>(116), static_cast<_FP16>(118), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(90), + static_cast<_FP16>(92), static_cast<_FP16>(94), + static_cast<_FP16>(96), static_cast<_FP16>(98), + static_cast<_FP16>(100), static_cast<_FP16>(102), + static_cast<_FP16>(104), static_cast<_FP16>(106), + static_cast<_FP16>(108), static_cast<_FP16>(110), + static_cast<_FP16>(112), static_cast<_FP16>(114), + static_cast<_FP16>(116), static_cast<_FP16>(118), + static_cast<_FP16>(120), static_cast<_FP16>(122), + static_cast<_FP16>(124), static_cast<_FP16>(126), + static_cast<_FP16>(128), static_cast<_FP16>(130), + static_cast<_FP16>(132), static_cast<_FP16>(134), + static_cast<_FP16>(136), static_cast<_FP16>(138), + static_cast<_FP16>(140), static_cast<_FP16>(142), + static_cast<_FP16>(144), static_cast<_FP16>(146), + static_cast<_FP16>(148), static_cast<_FP16>(150), + static_cast<_FP16>(152), static_cast<_FP16>(154), + static_cast<_FP16>(156), static_cast<_FP16>(158)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2166,67 +2154,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(2), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(8), static_cast<_Float16>(10), - static_cast<_Float16>(12), static_cast<_Float16>(14), - static_cast<_Float16>(16), static_cast<_Float16>(18), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(30), - static_cast<_Float16>(32), static_cast<_Float16>(34), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(30), - static_cast<_Float16>(32), static_cast<_Float16>(34), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(50), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(56), static_cast<_Float16>(58), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(68), static_cast<_Float16>(70), - static_cast<_Float16>(72), static_cast<_Float16>(74), - static_cast<_Float16>(76), static_cast<_Float16>(78), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(90), - static_cast<_Float16>(92), static_cast<_Float16>(94), - static_cast<_Float16>(96), static_cast<_Float16>(98), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(90), - static_cast<_Float16>(92), static_cast<_Float16>(94), - static_cast<_Float16>(96), static_cast<_Float16>(98), - static_cast<_Float16>(100), static_cast<_Float16>(102), - static_cast<_Float16>(104), static_cast<_Float16>(106), - static_cast<_Float16>(108), static_cast<_Float16>(110), - static_cast<_Float16>(112), static_cast<_Float16>(114), - static_cast<_Float16>(116), static_cast<_Float16>(118), - static_cast<_Float16>(120), static_cast<_Float16>(122), - static_cast<_Float16>(124), static_cast<_Float16>(126), - static_cast<_Float16>(128), static_cast<_Float16>(130), - static_cast<_Float16>(132), static_cast<_Float16>(134), - static_cast<_Float16>(136), static_cast<_Float16>(138), - static_cast<_Float16>(140), static_cast<_Float16>(142), - static_cast<_Float16>(144), static_cast<_Float16>(146), - static_cast<_Float16>(148), static_cast<_Float16>(150), - static_cast<_Float16>(152), static_cast<_Float16>(154), - static_cast<_Float16>(156), static_cast<_Float16>(158), - static_cast<_Float16>(140), static_cast<_Float16>(142), - static_cast<_Float16>(144), static_cast<_Float16>(146), - static_cast<_Float16>(148), static_cast<_Float16>(150), - static_cast<_Float16>(152), static_cast<_Float16>(154), - static_cast<_Float16>(156), static_cast<_Float16>(158), - static_cast<_Float16>(160), static_cast<_Float16>(162), - static_cast<_Float16>(164), static_cast<_Float16>(166), - static_cast<_Float16>(168), static_cast<_Float16>(170), - static_cast<_Float16>(172), static_cast<_Float16>(174), - static_cast<_Float16>(176), static_cast<_Float16>(178)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(2), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(8), static_cast<_FP16>(10), + static_cast<_FP16>(12), static_cast<_FP16>(14), + static_cast<_FP16>(16), static_cast<_FP16>(18), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(30), + static_cast<_FP16>(32), static_cast<_FP16>(34), + static_cast<_FP16>(36), static_cast<_FP16>(38), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(30), + static_cast<_FP16>(32), static_cast<_FP16>(34), + static_cast<_FP16>(36), static_cast<_FP16>(38), + static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(44), static_cast<_FP16>(46), + static_cast<_FP16>(48), static_cast<_FP16>(50), + static_cast<_FP16>(52), static_cast<_FP16>(54), + static_cast<_FP16>(56), static_cast<_FP16>(58), + static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(64), static_cast<_FP16>(66), + static_cast<_FP16>(68), static_cast<_FP16>(70), + static_cast<_FP16>(72), static_cast<_FP16>(74), + static_cast<_FP16>(76), static_cast<_FP16>(78), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(90), + static_cast<_FP16>(92), static_cast<_FP16>(94), + static_cast<_FP16>(96), static_cast<_FP16>(98), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(90), + static_cast<_FP16>(92), static_cast<_FP16>(94), + static_cast<_FP16>(96), static_cast<_FP16>(98), + static_cast<_FP16>(100), static_cast<_FP16>(102), + static_cast<_FP16>(104), static_cast<_FP16>(106), + static_cast<_FP16>(108), static_cast<_FP16>(110), + static_cast<_FP16>(112), static_cast<_FP16>(114), + static_cast<_FP16>(116), static_cast<_FP16>(118), + static_cast<_FP16>(120), static_cast<_FP16>(122), + static_cast<_FP16>(124), static_cast<_FP16>(126), + static_cast<_FP16>(128), static_cast<_FP16>(130), + static_cast<_FP16>(132), static_cast<_FP16>(134), + static_cast<_FP16>(136), static_cast<_FP16>(138), + static_cast<_FP16>(140), static_cast<_FP16>(142), + static_cast<_FP16>(144), static_cast<_FP16>(146), + static_cast<_FP16>(148), static_cast<_FP16>(150), + static_cast<_FP16>(152), static_cast<_FP16>(154), + static_cast<_FP16>(156), static_cast<_FP16>(158), + static_cast<_FP16>(140), static_cast<_FP16>(142), + static_cast<_FP16>(144), static_cast<_FP16>(146), + static_cast<_FP16>(148), static_cast<_FP16>(150), + static_cast<_FP16>(152), static_cast<_FP16>(154), + static_cast<_FP16>(156), static_cast<_FP16>(158), + static_cast<_FP16>(160), static_cast<_FP16>(162), + static_cast<_FP16>(164), static_cast<_FP16>(166), + static_cast<_FP16>(168), static_cast<_FP16>(170), + static_cast<_FP16>(172), static_cast<_FP16>(174), + static_cast<_FP16>(176), static_cast<_FP16>(178)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2237,67 +2224,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 2, 4, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(2), static_cast<_Float16>(3), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(7), static_cast<_Float16>(8), - static_cast<_Float16>(9), static_cast<_Float16>(10), - static_cast<_Float16>(12), static_cast<_Float16>(13), - static_cast<_Float16>(14), static_cast<_Float16>(15), - static_cast<_Float16>(16), static_cast<_Float16>(18), - static_cast<_Float16>(19), static_cast<_Float16>(20), - static_cast<_Float16>(21), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(25), - static_cast<_Float16>(26), static_cast<_Float16>(27), - static_cast<_Float16>(28), static_cast<_Float16>(30), - static_cast<_Float16>(31), static_cast<_Float16>(32), - static_cast<_Float16>(33), static_cast<_Float16>(34), - static_cast<_Float16>(36), static_cast<_Float16>(37), - static_cast<_Float16>(38), static_cast<_Float16>(39), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(43), static_cast<_Float16>(44), - static_cast<_Float16>(45), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(49), - static_cast<_Float16>(50), static_cast<_Float16>(51), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(55), static_cast<_Float16>(56), - static_cast<_Float16>(57), static_cast<_Float16>(58), - static_cast<_Float16>(60), static_cast<_Float16>(61), - static_cast<_Float16>(62), static_cast<_Float16>(63), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(67), static_cast<_Float16>(68), - static_cast<_Float16>(69), static_cast<_Float16>(70), - static_cast<_Float16>(72), static_cast<_Float16>(73), - static_cast<_Float16>(74), static_cast<_Float16>(75), - static_cast<_Float16>(76), static_cast<_Float16>(78), - static_cast<_Float16>(79), static_cast<_Float16>(80), - static_cast<_Float16>(81), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(85), - static_cast<_Float16>(86), static_cast<_Float16>(87), - static_cast<_Float16>(88), static_cast<_Float16>(90), - static_cast<_Float16>(91), static_cast<_Float16>(92), - static_cast<_Float16>(93), static_cast<_Float16>(94), - static_cast<_Float16>(96), static_cast<_Float16>(97), - static_cast<_Float16>(98), static_cast<_Float16>(99), - static_cast<_Float16>(100), static_cast<_Float16>(102), - static_cast<_Float16>(103), static_cast<_Float16>(104), - static_cast<_Float16>(105), static_cast<_Float16>(106), - static_cast<_Float16>(108), static_cast<_Float16>(109), - static_cast<_Float16>(110), static_cast<_Float16>(111), - static_cast<_Float16>(112), static_cast<_Float16>(114), - static_cast<_Float16>(115), static_cast<_Float16>(116), - static_cast<_Float16>(117), static_cast<_Float16>(118), - static_cast<_Float16>(120), static_cast<_Float16>(121), - static_cast<_Float16>(122), static_cast<_Float16>(123), - static_cast<_Float16>(124), static_cast<_Float16>(126), - static_cast<_Float16>(127), static_cast<_Float16>(128), - static_cast<_Float16>(129), static_cast<_Float16>(130), - static_cast<_Float16>(132), static_cast<_Float16>(133), - static_cast<_Float16>(134), static_cast<_Float16>(135), - static_cast<_Float16>(136), static_cast<_Float16>(138), - static_cast<_Float16>(139), static_cast<_Float16>(140), - static_cast<_Float16>(141), static_cast<_Float16>(142)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(2), static_cast<_FP16>(3), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(7), static_cast<_FP16>(8), + static_cast<_FP16>(9), static_cast<_FP16>(10), + static_cast<_FP16>(12), static_cast<_FP16>(13), + static_cast<_FP16>(14), static_cast<_FP16>(15), + static_cast<_FP16>(16), static_cast<_FP16>(18), + static_cast<_FP16>(19), static_cast<_FP16>(20), + static_cast<_FP16>(21), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(25), + static_cast<_FP16>(26), static_cast<_FP16>(27), + static_cast<_FP16>(28), static_cast<_FP16>(30), + static_cast<_FP16>(31), static_cast<_FP16>(32), + static_cast<_FP16>(33), static_cast<_FP16>(34), + static_cast<_FP16>(36), static_cast<_FP16>(37), + static_cast<_FP16>(38), static_cast<_FP16>(39), + static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(43), static_cast<_FP16>(44), + static_cast<_FP16>(45), static_cast<_FP16>(46), + static_cast<_FP16>(48), static_cast<_FP16>(49), + static_cast<_FP16>(50), static_cast<_FP16>(51), + static_cast<_FP16>(52), static_cast<_FP16>(54), + static_cast<_FP16>(55), static_cast<_FP16>(56), + static_cast<_FP16>(57), static_cast<_FP16>(58), + static_cast<_FP16>(60), static_cast<_FP16>(61), + static_cast<_FP16>(62), static_cast<_FP16>(63), + static_cast<_FP16>(64), static_cast<_FP16>(66), + static_cast<_FP16>(67), static_cast<_FP16>(68), + static_cast<_FP16>(69), static_cast<_FP16>(70), + static_cast<_FP16>(72), static_cast<_FP16>(73), + static_cast<_FP16>(74), static_cast<_FP16>(75), + static_cast<_FP16>(76), static_cast<_FP16>(78), + static_cast<_FP16>(79), static_cast<_FP16>(80), + static_cast<_FP16>(81), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(85), + static_cast<_FP16>(86), static_cast<_FP16>(87), + static_cast<_FP16>(88), static_cast<_FP16>(90), + static_cast<_FP16>(91), static_cast<_FP16>(92), + static_cast<_FP16>(93), static_cast<_FP16>(94), + static_cast<_FP16>(96), static_cast<_FP16>(97), + static_cast<_FP16>(98), static_cast<_FP16>(99), + static_cast<_FP16>(100), static_cast<_FP16>(102), + static_cast<_FP16>(103), static_cast<_FP16>(104), + static_cast<_FP16>(105), static_cast<_FP16>(106), + static_cast<_FP16>(108), static_cast<_FP16>(109), + static_cast<_FP16>(110), static_cast<_FP16>(111), + static_cast<_FP16>(112), static_cast<_FP16>(114), + static_cast<_FP16>(115), static_cast<_FP16>(116), + static_cast<_FP16>(117), static_cast<_FP16>(118), + static_cast<_FP16>(120), static_cast<_FP16>(121), + static_cast<_FP16>(122), static_cast<_FP16>(123), + static_cast<_FP16>(124), static_cast<_FP16>(126), + static_cast<_FP16>(127), static_cast<_FP16>(128), + static_cast<_FP16>(129), static_cast<_FP16>(130), + static_cast<_FP16>(132), static_cast<_FP16>(133), + static_cast<_FP16>(134), static_cast<_FP16>(135), + static_cast<_FP16>(136), static_cast<_FP16>(138), + static_cast<_FP16>(139), static_cast<_FP16>(140), + static_cast<_FP16>(141), static_cast<_FP16>(142)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2308,67 +2294,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(2), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(8), static_cast<_Float16>(5), - static_cast<_Float16>(7), static_cast<_Float16>(9), - static_cast<_Float16>(11), static_cast<_Float16>(13), - static_cast<_Float16>(10), static_cast<_Float16>(12), - static_cast<_Float16>(14), static_cast<_Float16>(16), - static_cast<_Float16>(18), static_cast<_Float16>(15), - static_cast<_Float16>(17), static_cast<_Float16>(19), - static_cast<_Float16>(21), static_cast<_Float16>(23), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(25), - static_cast<_Float16>(27), static_cast<_Float16>(29), - static_cast<_Float16>(31), static_cast<_Float16>(33), - static_cast<_Float16>(30), static_cast<_Float16>(32), - static_cast<_Float16>(34), static_cast<_Float16>(36), - static_cast<_Float16>(38), static_cast<_Float16>(35), - static_cast<_Float16>(37), static_cast<_Float16>(39), - static_cast<_Float16>(41), static_cast<_Float16>(43), - static_cast<_Float16>(45), static_cast<_Float16>(47), - static_cast<_Float16>(49), static_cast<_Float16>(51), - static_cast<_Float16>(53), static_cast<_Float16>(50), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(56), static_cast<_Float16>(58), - static_cast<_Float16>(55), static_cast<_Float16>(57), - static_cast<_Float16>(59), static_cast<_Float16>(61), - static_cast<_Float16>(63), static_cast<_Float16>(60), - static_cast<_Float16>(62), static_cast<_Float16>(64), - static_cast<_Float16>(66), static_cast<_Float16>(68), - static_cast<_Float16>(65), static_cast<_Float16>(67), - static_cast<_Float16>(69), static_cast<_Float16>(71), - static_cast<_Float16>(73), static_cast<_Float16>(70), - static_cast<_Float16>(72), static_cast<_Float16>(74), - static_cast<_Float16>(76), static_cast<_Float16>(78), - static_cast<_Float16>(75), static_cast<_Float16>(77), - static_cast<_Float16>(79), static_cast<_Float16>(81), - static_cast<_Float16>(83), static_cast<_Float16>(80), - static_cast<_Float16>(82), static_cast<_Float16>(84), - static_cast<_Float16>(86), static_cast<_Float16>(88), - static_cast<_Float16>(90), static_cast<_Float16>(92), - static_cast<_Float16>(94), static_cast<_Float16>(96), - static_cast<_Float16>(98), static_cast<_Float16>(95), - static_cast<_Float16>(97), static_cast<_Float16>(99), - static_cast<_Float16>(101), static_cast<_Float16>(103), - static_cast<_Float16>(100), static_cast<_Float16>(102), - static_cast<_Float16>(104), static_cast<_Float16>(106), - static_cast<_Float16>(108), static_cast<_Float16>(105), - static_cast<_Float16>(107), static_cast<_Float16>(109), - static_cast<_Float16>(111), static_cast<_Float16>(113), - static_cast<_Float16>(110), static_cast<_Float16>(112), - static_cast<_Float16>(114), static_cast<_Float16>(116), - static_cast<_Float16>(118), static_cast<_Float16>(115), - static_cast<_Float16>(117), static_cast<_Float16>(119), - static_cast<_Float16>(121), static_cast<_Float16>(123), - static_cast<_Float16>(120), static_cast<_Float16>(122), - static_cast<_Float16>(124), static_cast<_Float16>(126), - static_cast<_Float16>(128), static_cast<_Float16>(125), - static_cast<_Float16>(127), static_cast<_Float16>(129), - static_cast<_Float16>(131), static_cast<_Float16>(133)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(2), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(8), static_cast<_FP16>(5), + static_cast<_FP16>(7), static_cast<_FP16>(9), + static_cast<_FP16>(11), static_cast<_FP16>(13), + static_cast<_FP16>(10), static_cast<_FP16>(12), + static_cast<_FP16>(14), static_cast<_FP16>(16), + static_cast<_FP16>(18), static_cast<_FP16>(15), + static_cast<_FP16>(17), static_cast<_FP16>(19), + static_cast<_FP16>(21), static_cast<_FP16>(23), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(25), + static_cast<_FP16>(27), static_cast<_FP16>(29), + static_cast<_FP16>(31), static_cast<_FP16>(33), + static_cast<_FP16>(30), static_cast<_FP16>(32), + static_cast<_FP16>(34), static_cast<_FP16>(36), + static_cast<_FP16>(38), static_cast<_FP16>(35), + static_cast<_FP16>(37), static_cast<_FP16>(39), + static_cast<_FP16>(41), static_cast<_FP16>(43), + static_cast<_FP16>(45), static_cast<_FP16>(47), + static_cast<_FP16>(49), static_cast<_FP16>(51), + static_cast<_FP16>(53), static_cast<_FP16>(50), + static_cast<_FP16>(52), static_cast<_FP16>(54), + static_cast<_FP16>(56), static_cast<_FP16>(58), + static_cast<_FP16>(55), static_cast<_FP16>(57), + static_cast<_FP16>(59), static_cast<_FP16>(61), + static_cast<_FP16>(63), static_cast<_FP16>(60), + static_cast<_FP16>(62), static_cast<_FP16>(64), + static_cast<_FP16>(66), static_cast<_FP16>(68), + static_cast<_FP16>(65), static_cast<_FP16>(67), + static_cast<_FP16>(69), static_cast<_FP16>(71), + static_cast<_FP16>(73), static_cast<_FP16>(70), + static_cast<_FP16>(72), static_cast<_FP16>(74), + static_cast<_FP16>(76), static_cast<_FP16>(78), + static_cast<_FP16>(75), static_cast<_FP16>(77), + static_cast<_FP16>(79), static_cast<_FP16>(81), + static_cast<_FP16>(83), static_cast<_FP16>(80), + static_cast<_FP16>(82), static_cast<_FP16>(84), + static_cast<_FP16>(86), static_cast<_FP16>(88), + static_cast<_FP16>(90), static_cast<_FP16>(92), + static_cast<_FP16>(94), static_cast<_FP16>(96), + static_cast<_FP16>(98), static_cast<_FP16>(95), + static_cast<_FP16>(97), static_cast<_FP16>(99), + static_cast<_FP16>(101), static_cast<_FP16>(103), + static_cast<_FP16>(100), static_cast<_FP16>(102), + static_cast<_FP16>(104), static_cast<_FP16>(106), + static_cast<_FP16>(108), static_cast<_FP16>(105), + static_cast<_FP16>(107), static_cast<_FP16>(109), + static_cast<_FP16>(111), static_cast<_FP16>(113), + static_cast<_FP16>(110), static_cast<_FP16>(112), + static_cast<_FP16>(114), static_cast<_FP16>(116), + static_cast<_FP16>(118), static_cast<_FP16>(115), + static_cast<_FP16>(117), static_cast<_FP16>(119), + static_cast<_FP16>(121), static_cast<_FP16>(123), + static_cast<_FP16>(120), static_cast<_FP16>(122), + static_cast<_FP16>(124), static_cast<_FP16>(126), + static_cast<_FP16>(128), static_cast<_FP16>(125), + static_cast<_FP16>(127), static_cast<_FP16>(129), + static_cast<_FP16>(131), static_cast<_FP16>(133)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2379,67 +2364,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 2, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(2), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(8), static_cast<_Float16>(5), - static_cast<_Float16>(7), static_cast<_Float16>(9), - static_cast<_Float16>(11), static_cast<_Float16>(13), - static_cast<_Float16>(10), static_cast<_Float16>(12), - static_cast<_Float16>(14), static_cast<_Float16>(16), - static_cast<_Float16>(18), static_cast<_Float16>(15), - static_cast<_Float16>(17), static_cast<_Float16>(19), - static_cast<_Float16>(21), static_cast<_Float16>(23), - static_cast<_Float16>(25), static_cast<_Float16>(27), - static_cast<_Float16>(29), static_cast<_Float16>(31), - static_cast<_Float16>(33), static_cast<_Float16>(30), - static_cast<_Float16>(32), static_cast<_Float16>(34), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(35), static_cast<_Float16>(37), - static_cast<_Float16>(39), static_cast<_Float16>(41), - static_cast<_Float16>(43), static_cast<_Float16>(40), - static_cast<_Float16>(42), static_cast<_Float16>(44), - static_cast<_Float16>(46), static_cast<_Float16>(48), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(45), - static_cast<_Float16>(47), static_cast<_Float16>(49), - static_cast<_Float16>(51), static_cast<_Float16>(53), - static_cast<_Float16>(50), static_cast<_Float16>(52), - static_cast<_Float16>(54), static_cast<_Float16>(56), - static_cast<_Float16>(58), static_cast<_Float16>(55), - static_cast<_Float16>(57), static_cast<_Float16>(59), - static_cast<_Float16>(61), static_cast<_Float16>(63), - static_cast<_Float16>(65), static_cast<_Float16>(67), - static_cast<_Float16>(69), static_cast<_Float16>(71), - static_cast<_Float16>(73), static_cast<_Float16>(70), - static_cast<_Float16>(72), static_cast<_Float16>(74), - static_cast<_Float16>(76), static_cast<_Float16>(78), - static_cast<_Float16>(75), static_cast<_Float16>(77), - static_cast<_Float16>(79), static_cast<_Float16>(81), - static_cast<_Float16>(83), static_cast<_Float16>(80), - static_cast<_Float16>(82), static_cast<_Float16>(84), - static_cast<_Float16>(86), static_cast<_Float16>(88), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(85), - static_cast<_Float16>(87), static_cast<_Float16>(89), - static_cast<_Float16>(91), static_cast<_Float16>(93), - static_cast<_Float16>(90), static_cast<_Float16>(92), - static_cast<_Float16>(94), static_cast<_Float16>(96), - static_cast<_Float16>(98), static_cast<_Float16>(95), - static_cast<_Float16>(97), static_cast<_Float16>(99), - static_cast<_Float16>(101), static_cast<_Float16>(103), - static_cast<_Float16>(105), static_cast<_Float16>(107), - static_cast<_Float16>(109), static_cast<_Float16>(111), - static_cast<_Float16>(113), static_cast<_Float16>(110), - static_cast<_Float16>(112), static_cast<_Float16>(114), - static_cast<_Float16>(116), static_cast<_Float16>(118), - static_cast<_Float16>(115), static_cast<_Float16>(117), - static_cast<_Float16>(119), static_cast<_Float16>(121), - static_cast<_Float16>(123), static_cast<_Float16>(120), - static_cast<_Float16>(122), static_cast<_Float16>(124), - static_cast<_Float16>(126), static_cast<_Float16>(128)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(2), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(8), static_cast<_FP16>(5), + static_cast<_FP16>(7), static_cast<_FP16>(9), + static_cast<_FP16>(11), static_cast<_FP16>(13), + static_cast<_FP16>(10), static_cast<_FP16>(12), + static_cast<_FP16>(14), static_cast<_FP16>(16), + static_cast<_FP16>(18), static_cast<_FP16>(15), + static_cast<_FP16>(17), static_cast<_FP16>(19), + static_cast<_FP16>(21), static_cast<_FP16>(23), + static_cast<_FP16>(25), static_cast<_FP16>(27), + static_cast<_FP16>(29), static_cast<_FP16>(31), + static_cast<_FP16>(33), static_cast<_FP16>(30), + static_cast<_FP16>(32), static_cast<_FP16>(34), + static_cast<_FP16>(36), static_cast<_FP16>(38), + static_cast<_FP16>(35), static_cast<_FP16>(37), + static_cast<_FP16>(39), static_cast<_FP16>(41), + static_cast<_FP16>(43), static_cast<_FP16>(40), + static_cast<_FP16>(42), static_cast<_FP16>(44), + static_cast<_FP16>(46), static_cast<_FP16>(48), + static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(44), static_cast<_FP16>(46), + static_cast<_FP16>(48), static_cast<_FP16>(45), + static_cast<_FP16>(47), static_cast<_FP16>(49), + static_cast<_FP16>(51), static_cast<_FP16>(53), + static_cast<_FP16>(50), static_cast<_FP16>(52), + static_cast<_FP16>(54), static_cast<_FP16>(56), + static_cast<_FP16>(58), static_cast<_FP16>(55), + static_cast<_FP16>(57), static_cast<_FP16>(59), + static_cast<_FP16>(61), static_cast<_FP16>(63), + static_cast<_FP16>(65), static_cast<_FP16>(67), + static_cast<_FP16>(69), static_cast<_FP16>(71), + static_cast<_FP16>(73), static_cast<_FP16>(70), + static_cast<_FP16>(72), static_cast<_FP16>(74), + static_cast<_FP16>(76), static_cast<_FP16>(78), + static_cast<_FP16>(75), static_cast<_FP16>(77), + static_cast<_FP16>(79), static_cast<_FP16>(81), + static_cast<_FP16>(83), static_cast<_FP16>(80), + static_cast<_FP16>(82), static_cast<_FP16>(84), + static_cast<_FP16>(86), static_cast<_FP16>(88), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(85), + static_cast<_FP16>(87), static_cast<_FP16>(89), + static_cast<_FP16>(91), static_cast<_FP16>(93), + static_cast<_FP16>(90), static_cast<_FP16>(92), + static_cast<_FP16>(94), static_cast<_FP16>(96), + static_cast<_FP16>(98), static_cast<_FP16>(95), + static_cast<_FP16>(97), static_cast<_FP16>(99), + static_cast<_FP16>(101), static_cast<_FP16>(103), + static_cast<_FP16>(105), static_cast<_FP16>(107), + static_cast<_FP16>(109), static_cast<_FP16>(111), + static_cast<_FP16>(113), static_cast<_FP16>(110), + static_cast<_FP16>(112), static_cast<_FP16>(114), + static_cast<_FP16>(116), static_cast<_FP16>(118), + static_cast<_FP16>(115), static_cast<_FP16>(117), + static_cast<_FP16>(119), static_cast<_FP16>(121), + static_cast<_FP16>(123), static_cast<_FP16>(120), + static_cast<_FP16>(122), static_cast<_FP16>(124), + static_cast<_FP16>(126), static_cast<_FP16>(128)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2450,67 +2434,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 4, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(2), static_cast<_Float16>(3), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(7), static_cast<_Float16>(8), - static_cast<_Float16>(9), static_cast<_Float16>(10), - static_cast<_Float16>(12), static_cast<_Float16>(13), - static_cast<_Float16>(14), static_cast<_Float16>(15), - static_cast<_Float16>(16), static_cast<_Float16>(18), - static_cast<_Float16>(19), static_cast<_Float16>(20), - static_cast<_Float16>(21), static_cast<_Float16>(22), - static_cast<_Float16>(20), static_cast<_Float16>(21), - static_cast<_Float16>(22), static_cast<_Float16>(23), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(27), static_cast<_Float16>(28), - static_cast<_Float16>(29), static_cast<_Float16>(30), - static_cast<_Float16>(32), static_cast<_Float16>(33), - static_cast<_Float16>(34), static_cast<_Float16>(35), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(39), static_cast<_Float16>(40), - static_cast<_Float16>(41), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(45), - static_cast<_Float16>(46), static_cast<_Float16>(47), - static_cast<_Float16>(48), static_cast<_Float16>(50), - static_cast<_Float16>(51), static_cast<_Float16>(52), - static_cast<_Float16>(53), static_cast<_Float16>(54), - static_cast<_Float16>(56), static_cast<_Float16>(57), - static_cast<_Float16>(58), static_cast<_Float16>(59), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(63), static_cast<_Float16>(64), - static_cast<_Float16>(65), static_cast<_Float16>(66), - static_cast<_Float16>(64), static_cast<_Float16>(65), - static_cast<_Float16>(66), static_cast<_Float16>(67), - static_cast<_Float16>(68), static_cast<_Float16>(70), - static_cast<_Float16>(71), static_cast<_Float16>(72), - static_cast<_Float16>(73), static_cast<_Float16>(74), - static_cast<_Float16>(76), static_cast<_Float16>(77), - static_cast<_Float16>(78), static_cast<_Float16>(79), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(83), static_cast<_Float16>(84), - static_cast<_Float16>(85), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(89), - static_cast<_Float16>(90), static_cast<_Float16>(91), - static_cast<_Float16>(92), static_cast<_Float16>(94), - static_cast<_Float16>(95), static_cast<_Float16>(96), - static_cast<_Float16>(97), static_cast<_Float16>(98), - static_cast<_Float16>(100), static_cast<_Float16>(101), - static_cast<_Float16>(102), static_cast<_Float16>(103), - static_cast<_Float16>(104), static_cast<_Float16>(106), - static_cast<_Float16>(107), static_cast<_Float16>(108), - static_cast<_Float16>(109), static_cast<_Float16>(110), - static_cast<_Float16>(108), static_cast<_Float16>(109), - static_cast<_Float16>(110), static_cast<_Float16>(111), - static_cast<_Float16>(112), static_cast<_Float16>(114), - static_cast<_Float16>(115), static_cast<_Float16>(116), - static_cast<_Float16>(117), static_cast<_Float16>(118), - static_cast<_Float16>(120), static_cast<_Float16>(121), - static_cast<_Float16>(122), static_cast<_Float16>(123), - static_cast<_Float16>(124), static_cast<_Float16>(126), - static_cast<_Float16>(127), static_cast<_Float16>(128), - static_cast<_Float16>(129), static_cast<_Float16>(130)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(2), static_cast<_FP16>(3), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(7), static_cast<_FP16>(8), + static_cast<_FP16>(9), static_cast<_FP16>(10), + static_cast<_FP16>(12), static_cast<_FP16>(13), + static_cast<_FP16>(14), static_cast<_FP16>(15), + static_cast<_FP16>(16), static_cast<_FP16>(18), + static_cast<_FP16>(19), static_cast<_FP16>(20), + static_cast<_FP16>(21), static_cast<_FP16>(22), + static_cast<_FP16>(20), static_cast<_FP16>(21), + static_cast<_FP16>(22), static_cast<_FP16>(23), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(27), static_cast<_FP16>(28), + static_cast<_FP16>(29), static_cast<_FP16>(30), + static_cast<_FP16>(32), static_cast<_FP16>(33), + static_cast<_FP16>(34), static_cast<_FP16>(35), + static_cast<_FP16>(36), static_cast<_FP16>(38), + static_cast<_FP16>(39), static_cast<_FP16>(40), + static_cast<_FP16>(41), static_cast<_FP16>(42), + static_cast<_FP16>(44), static_cast<_FP16>(45), + static_cast<_FP16>(46), static_cast<_FP16>(47), + static_cast<_FP16>(48), static_cast<_FP16>(50), + static_cast<_FP16>(51), static_cast<_FP16>(52), + static_cast<_FP16>(53), static_cast<_FP16>(54), + static_cast<_FP16>(56), static_cast<_FP16>(57), + static_cast<_FP16>(58), static_cast<_FP16>(59), + static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(63), static_cast<_FP16>(64), + static_cast<_FP16>(65), static_cast<_FP16>(66), + static_cast<_FP16>(64), static_cast<_FP16>(65), + static_cast<_FP16>(66), static_cast<_FP16>(67), + static_cast<_FP16>(68), static_cast<_FP16>(70), + static_cast<_FP16>(71), static_cast<_FP16>(72), + static_cast<_FP16>(73), static_cast<_FP16>(74), + static_cast<_FP16>(76), static_cast<_FP16>(77), + static_cast<_FP16>(78), static_cast<_FP16>(79), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(83), static_cast<_FP16>(84), + static_cast<_FP16>(85), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(89), + static_cast<_FP16>(90), static_cast<_FP16>(91), + static_cast<_FP16>(92), static_cast<_FP16>(94), + static_cast<_FP16>(95), static_cast<_FP16>(96), + static_cast<_FP16>(97), static_cast<_FP16>(98), + static_cast<_FP16>(100), static_cast<_FP16>(101), + static_cast<_FP16>(102), static_cast<_FP16>(103), + static_cast<_FP16>(104), static_cast<_FP16>(106), + static_cast<_FP16>(107), static_cast<_FP16>(108), + static_cast<_FP16>(109), static_cast<_FP16>(110), + static_cast<_FP16>(108), static_cast<_FP16>(109), + static_cast<_FP16>(110), static_cast<_FP16>(111), + static_cast<_FP16>(112), static_cast<_FP16>(114), + static_cast<_FP16>(115), static_cast<_FP16>(116), + static_cast<_FP16>(117), static_cast<_FP16>(118), + static_cast<_FP16>(120), static_cast<_FP16>(121), + static_cast<_FP16>(122), static_cast<_FP16>(123), + static_cast<_FP16>(124), static_cast<_FP16>(126), + static_cast<_FP16>(127), static_cast<_FP16>(128), + static_cast<_FP16>(129), static_cast<_FP16>(130)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2521,67 +2504,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 1, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(2), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(8), static_cast<_Float16>(5), - static_cast<_Float16>(7), static_cast<_Float16>(9), - static_cast<_Float16>(11), static_cast<_Float16>(13), - static_cast<_Float16>(10), static_cast<_Float16>(12), - static_cast<_Float16>(14), static_cast<_Float16>(16), - static_cast<_Float16>(18), static_cast<_Float16>(15), - static_cast<_Float16>(17), static_cast<_Float16>(19), - static_cast<_Float16>(21), static_cast<_Float16>(23), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(25), - static_cast<_Float16>(27), static_cast<_Float16>(29), - static_cast<_Float16>(31), static_cast<_Float16>(33), - static_cast<_Float16>(30), static_cast<_Float16>(32), - static_cast<_Float16>(34), static_cast<_Float16>(36), - static_cast<_Float16>(38), static_cast<_Float16>(35), - static_cast<_Float16>(37), static_cast<_Float16>(39), - static_cast<_Float16>(41), static_cast<_Float16>(43), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(45), - static_cast<_Float16>(47), static_cast<_Float16>(49), - static_cast<_Float16>(51), static_cast<_Float16>(53), - static_cast<_Float16>(50), static_cast<_Float16>(52), - static_cast<_Float16>(54), static_cast<_Float16>(56), - static_cast<_Float16>(58), static_cast<_Float16>(55), - static_cast<_Float16>(57), static_cast<_Float16>(59), - static_cast<_Float16>(61), static_cast<_Float16>(63), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(68), static_cast<_Float16>(65), - static_cast<_Float16>(67), static_cast<_Float16>(69), - static_cast<_Float16>(71), static_cast<_Float16>(73), - static_cast<_Float16>(70), static_cast<_Float16>(72), - static_cast<_Float16>(74), static_cast<_Float16>(76), - static_cast<_Float16>(78), static_cast<_Float16>(75), - static_cast<_Float16>(77), static_cast<_Float16>(79), - static_cast<_Float16>(81), static_cast<_Float16>(83), - static_cast<_Float16>(80), static_cast<_Float16>(82), - static_cast<_Float16>(84), static_cast<_Float16>(86), - static_cast<_Float16>(88), static_cast<_Float16>(85), - static_cast<_Float16>(87), static_cast<_Float16>(89), - static_cast<_Float16>(91), static_cast<_Float16>(93), - static_cast<_Float16>(90), static_cast<_Float16>(92), - static_cast<_Float16>(94), static_cast<_Float16>(96), - static_cast<_Float16>(98), static_cast<_Float16>(95), - static_cast<_Float16>(97), static_cast<_Float16>(99), - static_cast<_Float16>(101), static_cast<_Float16>(103), - static_cast<_Float16>(100), static_cast<_Float16>(102), - static_cast<_Float16>(104), static_cast<_Float16>(106), - static_cast<_Float16>(108), static_cast<_Float16>(105), - static_cast<_Float16>(107), static_cast<_Float16>(109), - static_cast<_Float16>(111), static_cast<_Float16>(113), - static_cast<_Float16>(110), static_cast<_Float16>(112), - static_cast<_Float16>(114), static_cast<_Float16>(116), - static_cast<_Float16>(118), static_cast<_Float16>(115), - static_cast<_Float16>(117), static_cast<_Float16>(119), - static_cast<_Float16>(121), static_cast<_Float16>(123)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(2), + static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(8), static_cast<_FP16>(5), + static_cast<_FP16>(7), static_cast<_FP16>(9), + static_cast<_FP16>(11), static_cast<_FP16>(13), + static_cast<_FP16>(10), static_cast<_FP16>(12), + static_cast<_FP16>(14), static_cast<_FP16>(16), + static_cast<_FP16>(18), static_cast<_FP16>(15), + static_cast<_FP16>(17), static_cast<_FP16>(19), + static_cast<_FP16>(21), static_cast<_FP16>(23), + static_cast<_FP16>(20), static_cast<_FP16>(22), + static_cast<_FP16>(24), static_cast<_FP16>(26), + static_cast<_FP16>(28), static_cast<_FP16>(25), + static_cast<_FP16>(27), static_cast<_FP16>(29), + static_cast<_FP16>(31), static_cast<_FP16>(33), + static_cast<_FP16>(30), static_cast<_FP16>(32), + static_cast<_FP16>(34), static_cast<_FP16>(36), + static_cast<_FP16>(38), static_cast<_FP16>(35), + static_cast<_FP16>(37), static_cast<_FP16>(39), + static_cast<_FP16>(41), static_cast<_FP16>(43), + static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(44), static_cast<_FP16>(46), + static_cast<_FP16>(48), static_cast<_FP16>(45), + static_cast<_FP16>(47), static_cast<_FP16>(49), + static_cast<_FP16>(51), static_cast<_FP16>(53), + static_cast<_FP16>(50), static_cast<_FP16>(52), + static_cast<_FP16>(54), static_cast<_FP16>(56), + static_cast<_FP16>(58), static_cast<_FP16>(55), + static_cast<_FP16>(57), static_cast<_FP16>(59), + static_cast<_FP16>(61), static_cast<_FP16>(63), + static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(64), static_cast<_FP16>(66), + static_cast<_FP16>(68), static_cast<_FP16>(65), + static_cast<_FP16>(67), static_cast<_FP16>(69), + static_cast<_FP16>(71), static_cast<_FP16>(73), + static_cast<_FP16>(70), static_cast<_FP16>(72), + static_cast<_FP16>(74), static_cast<_FP16>(76), + static_cast<_FP16>(78), static_cast<_FP16>(75), + static_cast<_FP16>(77), static_cast<_FP16>(79), + static_cast<_FP16>(81), static_cast<_FP16>(83), + static_cast<_FP16>(80), static_cast<_FP16>(82), + static_cast<_FP16>(84), static_cast<_FP16>(86), + static_cast<_FP16>(88), static_cast<_FP16>(85), + static_cast<_FP16>(87), static_cast<_FP16>(89), + static_cast<_FP16>(91), static_cast<_FP16>(93), + static_cast<_FP16>(90), static_cast<_FP16>(92), + static_cast<_FP16>(94), static_cast<_FP16>(96), + static_cast<_FP16>(98), static_cast<_FP16>(95), + static_cast<_FP16>(97), static_cast<_FP16>(99), + static_cast<_FP16>(101), static_cast<_FP16>(103), + static_cast<_FP16>(100), static_cast<_FP16>(102), + static_cast<_FP16>(104), static_cast<_FP16>(106), + static_cast<_FP16>(108), static_cast<_FP16>(105), + static_cast<_FP16>(107), static_cast<_FP16>(109), + static_cast<_FP16>(111), static_cast<_FP16>(113), + static_cast<_FP16>(110), static_cast<_FP16>(112), + static_cast<_FP16>(114), static_cast<_FP16>(116), + static_cast<_FP16>(118), static_cast<_FP16>(115), + static_cast<_FP16>(117), static_cast<_FP16>(119), + static_cast<_FP16>(121), static_cast<_FP16>(123)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2592,67 +2574,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 2, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(2), static_cast<_Float16>(3), - static_cast<_Float16>(4), static_cast<_Float16>(5), - static_cast<_Float16>(6), static_cast<_Float16>(7), - static_cast<_Float16>(8), static_cast<_Float16>(9), - static_cast<_Float16>(10), static_cast<_Float16>(11), - static_cast<_Float16>(12), static_cast<_Float16>(13), - static_cast<_Float16>(14), static_cast<_Float16>(15), - static_cast<_Float16>(16), static_cast<_Float16>(17), - static_cast<_Float16>(18), static_cast<_Float16>(19), - static_cast<_Float16>(21), static_cast<_Float16>(22), - static_cast<_Float16>(23), static_cast<_Float16>(24), - static_cast<_Float16>(25), static_cast<_Float16>(26), - static_cast<_Float16>(27), static_cast<_Float16>(28), - static_cast<_Float16>(29), static_cast<_Float16>(30), - static_cast<_Float16>(31), static_cast<_Float16>(32), - static_cast<_Float16>(33), static_cast<_Float16>(34), - static_cast<_Float16>(35), static_cast<_Float16>(36), - static_cast<_Float16>(37), static_cast<_Float16>(38), - static_cast<_Float16>(39), static_cast<_Float16>(40), - static_cast<_Float16>(40), static_cast<_Float16>(41), - static_cast<_Float16>(42), static_cast<_Float16>(43), - static_cast<_Float16>(44), static_cast<_Float16>(45), - static_cast<_Float16>(46), static_cast<_Float16>(47), - static_cast<_Float16>(48), static_cast<_Float16>(49), - static_cast<_Float16>(50), static_cast<_Float16>(51), - static_cast<_Float16>(52), static_cast<_Float16>(53), - static_cast<_Float16>(54), static_cast<_Float16>(55), - static_cast<_Float16>(56), static_cast<_Float16>(57), - static_cast<_Float16>(58), static_cast<_Float16>(59), - static_cast<_Float16>(61), static_cast<_Float16>(62), - static_cast<_Float16>(63), static_cast<_Float16>(64), - static_cast<_Float16>(65), static_cast<_Float16>(66), - static_cast<_Float16>(67), static_cast<_Float16>(68), - static_cast<_Float16>(69), static_cast<_Float16>(70), - static_cast<_Float16>(71), static_cast<_Float16>(72), - static_cast<_Float16>(73), static_cast<_Float16>(74), - static_cast<_Float16>(75), static_cast<_Float16>(76), - static_cast<_Float16>(77), static_cast<_Float16>(78), - static_cast<_Float16>(79), static_cast<_Float16>(80), - static_cast<_Float16>(80), static_cast<_Float16>(81), - static_cast<_Float16>(82), static_cast<_Float16>(83), - static_cast<_Float16>(84), static_cast<_Float16>(85), - static_cast<_Float16>(86), static_cast<_Float16>(87), - static_cast<_Float16>(88), static_cast<_Float16>(89), - static_cast<_Float16>(90), static_cast<_Float16>(91), - static_cast<_Float16>(92), static_cast<_Float16>(93), - static_cast<_Float16>(94), static_cast<_Float16>(95), - static_cast<_Float16>(96), static_cast<_Float16>(97), - static_cast<_Float16>(98), static_cast<_Float16>(99), - static_cast<_Float16>(101), static_cast<_Float16>(102), - static_cast<_Float16>(103), static_cast<_Float16>(104), - static_cast<_Float16>(105), static_cast<_Float16>(106), - static_cast<_Float16>(107), static_cast<_Float16>(108), - static_cast<_Float16>(109), static_cast<_Float16>(110), - static_cast<_Float16>(111), static_cast<_Float16>(112), - static_cast<_Float16>(113), static_cast<_Float16>(114), - static_cast<_Float16>(115), static_cast<_Float16>(116), - static_cast<_Float16>(117), static_cast<_Float16>(118), - static_cast<_Float16>(119), static_cast<_Float16>(120)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(2), static_cast<_FP16>(3), + static_cast<_FP16>(4), static_cast<_FP16>(5), + static_cast<_FP16>(6), static_cast<_FP16>(7), + static_cast<_FP16>(8), static_cast<_FP16>(9), + static_cast<_FP16>(10), static_cast<_FP16>(11), + static_cast<_FP16>(12), static_cast<_FP16>(13), + static_cast<_FP16>(14), static_cast<_FP16>(15), + static_cast<_FP16>(16), static_cast<_FP16>(17), + static_cast<_FP16>(18), static_cast<_FP16>(19), + static_cast<_FP16>(21), static_cast<_FP16>(22), + static_cast<_FP16>(23), static_cast<_FP16>(24), + static_cast<_FP16>(25), static_cast<_FP16>(26), + static_cast<_FP16>(27), static_cast<_FP16>(28), + static_cast<_FP16>(29), static_cast<_FP16>(30), + static_cast<_FP16>(31), static_cast<_FP16>(32), + static_cast<_FP16>(33), static_cast<_FP16>(34), + static_cast<_FP16>(35), static_cast<_FP16>(36), + static_cast<_FP16>(37), static_cast<_FP16>(38), + static_cast<_FP16>(39), static_cast<_FP16>(40), + static_cast<_FP16>(40), static_cast<_FP16>(41), + static_cast<_FP16>(42), static_cast<_FP16>(43), + static_cast<_FP16>(44), static_cast<_FP16>(45), + static_cast<_FP16>(46), static_cast<_FP16>(47), + static_cast<_FP16>(48), static_cast<_FP16>(49), + static_cast<_FP16>(50), static_cast<_FP16>(51), + static_cast<_FP16>(52), static_cast<_FP16>(53), + static_cast<_FP16>(54), static_cast<_FP16>(55), + static_cast<_FP16>(56), static_cast<_FP16>(57), + static_cast<_FP16>(58), static_cast<_FP16>(59), + static_cast<_FP16>(61), static_cast<_FP16>(62), + static_cast<_FP16>(63), static_cast<_FP16>(64), + static_cast<_FP16>(65), static_cast<_FP16>(66), + static_cast<_FP16>(67), static_cast<_FP16>(68), + static_cast<_FP16>(69), static_cast<_FP16>(70), + static_cast<_FP16>(71), static_cast<_FP16>(72), + static_cast<_FP16>(73), static_cast<_FP16>(74), + static_cast<_FP16>(75), static_cast<_FP16>(76), + static_cast<_FP16>(77), static_cast<_FP16>(78), + static_cast<_FP16>(79), static_cast<_FP16>(80), + static_cast<_FP16>(80), static_cast<_FP16>(81), + static_cast<_FP16>(82), static_cast<_FP16>(83), + static_cast<_FP16>(84), static_cast<_FP16>(85), + static_cast<_FP16>(86), static_cast<_FP16>(87), + static_cast<_FP16>(88), static_cast<_FP16>(89), + static_cast<_FP16>(90), static_cast<_FP16>(91), + static_cast<_FP16>(92), static_cast<_FP16>(93), + static_cast<_FP16>(94), static_cast<_FP16>(95), + static_cast<_FP16>(96), static_cast<_FP16>(97), + static_cast<_FP16>(98), static_cast<_FP16>(99), + static_cast<_FP16>(101), static_cast<_FP16>(102), + static_cast<_FP16>(103), static_cast<_FP16>(104), + static_cast<_FP16>(105), static_cast<_FP16>(106), + static_cast<_FP16>(107), static_cast<_FP16>(108), + static_cast<_FP16>(109), static_cast<_FP16>(110), + static_cast<_FP16>(111), static_cast<_FP16>(112), + static_cast<_FP16>(113), static_cast<_FP16>(114), + static_cast<_FP16>(115), static_cast<_FP16>(116), + static_cast<_FP16>(117), static_cast<_FP16>(118), + static_cast<_FP16>(119), static_cast<_FP16>(120)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2663,67 +2644,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(1), - static_cast<_Float16>(2), static_cast<_Float16>(3), - static_cast<_Float16>(4), static_cast<_Float16>(5), - static_cast<_Float16>(6), static_cast<_Float16>(7), - static_cast<_Float16>(8), static_cast<_Float16>(9), - static_cast<_Float16>(10), static_cast<_Float16>(11), - static_cast<_Float16>(12), static_cast<_Float16>(13), - static_cast<_Float16>(14), static_cast<_Float16>(15), - static_cast<_Float16>(16), static_cast<_Float16>(17), - static_cast<_Float16>(18), static_cast<_Float16>(19), - static_cast<_Float16>(20), static_cast<_Float16>(21), - static_cast<_Float16>(22), static_cast<_Float16>(23), - static_cast<_Float16>(24), static_cast<_Float16>(25), - static_cast<_Float16>(26), static_cast<_Float16>(27), - static_cast<_Float16>(28), static_cast<_Float16>(29), - static_cast<_Float16>(30), static_cast<_Float16>(31), - static_cast<_Float16>(32), static_cast<_Float16>(33), - static_cast<_Float16>(34), static_cast<_Float16>(35), - static_cast<_Float16>(36), static_cast<_Float16>(37), - static_cast<_Float16>(38), static_cast<_Float16>(39), - static_cast<_Float16>(41), static_cast<_Float16>(42), - static_cast<_Float16>(43), static_cast<_Float16>(44), - static_cast<_Float16>(45), static_cast<_Float16>(46), - static_cast<_Float16>(47), static_cast<_Float16>(48), - static_cast<_Float16>(49), static_cast<_Float16>(50), - static_cast<_Float16>(51), static_cast<_Float16>(52), - static_cast<_Float16>(53), static_cast<_Float16>(54), - static_cast<_Float16>(55), static_cast<_Float16>(56), - static_cast<_Float16>(57), static_cast<_Float16>(58), - static_cast<_Float16>(59), static_cast<_Float16>(60), - static_cast<_Float16>(61), static_cast<_Float16>(62), - static_cast<_Float16>(63), static_cast<_Float16>(64), - static_cast<_Float16>(65), static_cast<_Float16>(66), - static_cast<_Float16>(67), static_cast<_Float16>(68), - static_cast<_Float16>(69), static_cast<_Float16>(70), - static_cast<_Float16>(71), static_cast<_Float16>(72), - static_cast<_Float16>(73), static_cast<_Float16>(74), - static_cast<_Float16>(75), static_cast<_Float16>(76), - static_cast<_Float16>(77), static_cast<_Float16>(78), - static_cast<_Float16>(79), static_cast<_Float16>(80), - static_cast<_Float16>(82), static_cast<_Float16>(83), - static_cast<_Float16>(84), static_cast<_Float16>(85), - static_cast<_Float16>(86), static_cast<_Float16>(87), - static_cast<_Float16>(88), static_cast<_Float16>(89), - static_cast<_Float16>(90), static_cast<_Float16>(91), - static_cast<_Float16>(92), static_cast<_Float16>(93), - static_cast<_Float16>(94), static_cast<_Float16>(95), - static_cast<_Float16>(96), static_cast<_Float16>(97), - static_cast<_Float16>(98), static_cast<_Float16>(99), - static_cast<_Float16>(100), static_cast<_Float16>(101), - static_cast<_Float16>(102), static_cast<_Float16>(103), - static_cast<_Float16>(104), static_cast<_Float16>(105), - static_cast<_Float16>(106), static_cast<_Float16>(107), - static_cast<_Float16>(108), static_cast<_Float16>(109), - static_cast<_Float16>(110), static_cast<_Float16>(111), - static_cast<_Float16>(112), static_cast<_Float16>(113), - static_cast<_Float16>(114), static_cast<_Float16>(115), - static_cast<_Float16>(116), static_cast<_Float16>(117), - static_cast<_Float16>(118), static_cast<_Float16>(119), - static_cast<_Float16>(120), static_cast<_Float16>(121)}; + _FP16 answer_data[] = {static_cast<_FP16>(0), static_cast<_FP16>(1), + static_cast<_FP16>(2), static_cast<_FP16>(3), + static_cast<_FP16>(4), static_cast<_FP16>(5), + static_cast<_FP16>(6), static_cast<_FP16>(7), + static_cast<_FP16>(8), static_cast<_FP16>(9), + static_cast<_FP16>(10), static_cast<_FP16>(11), + static_cast<_FP16>(12), static_cast<_FP16>(13), + static_cast<_FP16>(14), static_cast<_FP16>(15), + static_cast<_FP16>(16), static_cast<_FP16>(17), + static_cast<_FP16>(18), static_cast<_FP16>(19), + static_cast<_FP16>(20), static_cast<_FP16>(21), + static_cast<_FP16>(22), static_cast<_FP16>(23), + static_cast<_FP16>(24), static_cast<_FP16>(25), + static_cast<_FP16>(26), static_cast<_FP16>(27), + static_cast<_FP16>(28), static_cast<_FP16>(29), + static_cast<_FP16>(30), static_cast<_FP16>(31), + static_cast<_FP16>(32), static_cast<_FP16>(33), + static_cast<_FP16>(34), static_cast<_FP16>(35), + static_cast<_FP16>(36), static_cast<_FP16>(37), + static_cast<_FP16>(38), static_cast<_FP16>(39), + static_cast<_FP16>(41), static_cast<_FP16>(42), + static_cast<_FP16>(43), static_cast<_FP16>(44), + static_cast<_FP16>(45), static_cast<_FP16>(46), + static_cast<_FP16>(47), static_cast<_FP16>(48), + static_cast<_FP16>(49), static_cast<_FP16>(50), + static_cast<_FP16>(51), static_cast<_FP16>(52), + static_cast<_FP16>(53), static_cast<_FP16>(54), + static_cast<_FP16>(55), static_cast<_FP16>(56), + static_cast<_FP16>(57), static_cast<_FP16>(58), + static_cast<_FP16>(59), static_cast<_FP16>(60), + static_cast<_FP16>(61), static_cast<_FP16>(62), + static_cast<_FP16>(63), static_cast<_FP16>(64), + static_cast<_FP16>(65), static_cast<_FP16>(66), + static_cast<_FP16>(67), static_cast<_FP16>(68), + static_cast<_FP16>(69), static_cast<_FP16>(70), + static_cast<_FP16>(71), static_cast<_FP16>(72), + static_cast<_FP16>(73), static_cast<_FP16>(74), + static_cast<_FP16>(75), static_cast<_FP16>(76), + static_cast<_FP16>(77), static_cast<_FP16>(78), + static_cast<_FP16>(79), static_cast<_FP16>(80), + static_cast<_FP16>(82), static_cast<_FP16>(83), + static_cast<_FP16>(84), static_cast<_FP16>(85), + static_cast<_FP16>(86), static_cast<_FP16>(87), + static_cast<_FP16>(88), static_cast<_FP16>(89), + static_cast<_FP16>(90), static_cast<_FP16>(91), + static_cast<_FP16>(92), static_cast<_FP16>(93), + static_cast<_FP16>(94), static_cast<_FP16>(95), + static_cast<_FP16>(96), static_cast<_FP16>(97), + static_cast<_FP16>(98), static_cast<_FP16>(99), + static_cast<_FP16>(100), static_cast<_FP16>(101), + static_cast<_FP16>(102), static_cast<_FP16>(103), + static_cast<_FP16>(104), static_cast<_FP16>(105), + static_cast<_FP16>(106), static_cast<_FP16>(107), + static_cast<_FP16>(108), static_cast<_FP16>(109), + static_cast<_FP16>(110), static_cast<_FP16>(111), + static_cast<_FP16>(112), static_cast<_FP16>(113), + static_cast<_FP16>(114), static_cast<_FP16>(115), + static_cast<_FP16>(116), static_cast<_FP16>(117), + static_cast<_FP16>(118), static_cast<_FP16>(119), + static_cast<_FP16>(120), static_cast<_FP16>(121)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2735,67 +2715,66 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { nntrainer::Tensor m = ranged(1, 1, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); m.add_i(1.0); - _Float16 answer_data[] = { - static_cast<_Float16>(1), static_cast<_Float16>(2), - static_cast<_Float16>(3), static_cast<_Float16>(4), - static_cast<_Float16>(5), static_cast<_Float16>(6), - static_cast<_Float16>(7), static_cast<_Float16>(8), - static_cast<_Float16>(9), static_cast<_Float16>(10), - static_cast<_Float16>(11), static_cast<_Float16>(12), - static_cast<_Float16>(13), static_cast<_Float16>(14), - static_cast<_Float16>(15), static_cast<_Float16>(16), - static_cast<_Float16>(17), static_cast<_Float16>(18), - static_cast<_Float16>(19), static_cast<_Float16>(20), - static_cast<_Float16>(21), static_cast<_Float16>(22), - static_cast<_Float16>(23), static_cast<_Float16>(24), - static_cast<_Float16>(25), static_cast<_Float16>(26), - static_cast<_Float16>(27), static_cast<_Float16>(28), - static_cast<_Float16>(29), static_cast<_Float16>(30), - static_cast<_Float16>(31), static_cast<_Float16>(32), - static_cast<_Float16>(33), static_cast<_Float16>(34), - static_cast<_Float16>(35), static_cast<_Float16>(36), - static_cast<_Float16>(37), static_cast<_Float16>(38), - static_cast<_Float16>(39), static_cast<_Float16>(40), - static_cast<_Float16>(41), static_cast<_Float16>(42), - static_cast<_Float16>(43), static_cast<_Float16>(44), - static_cast<_Float16>(45), static_cast<_Float16>(46), - static_cast<_Float16>(47), static_cast<_Float16>(48), - static_cast<_Float16>(49), static_cast<_Float16>(50), - static_cast<_Float16>(51), static_cast<_Float16>(52), - static_cast<_Float16>(53), static_cast<_Float16>(54), - static_cast<_Float16>(55), static_cast<_Float16>(56), - static_cast<_Float16>(57), static_cast<_Float16>(58), - static_cast<_Float16>(59), static_cast<_Float16>(60), - static_cast<_Float16>(61), static_cast<_Float16>(62), - static_cast<_Float16>(63), static_cast<_Float16>(64), - static_cast<_Float16>(65), static_cast<_Float16>(66), - static_cast<_Float16>(67), static_cast<_Float16>(68), - static_cast<_Float16>(69), static_cast<_Float16>(70), - static_cast<_Float16>(71), static_cast<_Float16>(72), - static_cast<_Float16>(73), static_cast<_Float16>(74), - static_cast<_Float16>(75), static_cast<_Float16>(76), - static_cast<_Float16>(77), static_cast<_Float16>(78), - static_cast<_Float16>(79), static_cast<_Float16>(80), - static_cast<_Float16>(81), static_cast<_Float16>(82), - static_cast<_Float16>(83), static_cast<_Float16>(84), - static_cast<_Float16>(85), static_cast<_Float16>(86), - static_cast<_Float16>(87), static_cast<_Float16>(88), - static_cast<_Float16>(89), static_cast<_Float16>(90), - static_cast<_Float16>(91), static_cast<_Float16>(92), - static_cast<_Float16>(93), static_cast<_Float16>(94), - static_cast<_Float16>(95), static_cast<_Float16>(96), - static_cast<_Float16>(97), static_cast<_Float16>(98), - static_cast<_Float16>(99), static_cast<_Float16>(100), - static_cast<_Float16>(101), static_cast<_Float16>(102), - static_cast<_Float16>(103), static_cast<_Float16>(104), - static_cast<_Float16>(105), static_cast<_Float16>(106), - static_cast<_Float16>(107), static_cast<_Float16>(108), - static_cast<_Float16>(109), static_cast<_Float16>(110), - static_cast<_Float16>(111), static_cast<_Float16>(112), - static_cast<_Float16>(113), static_cast<_Float16>(114), - static_cast<_Float16>(115), static_cast<_Float16>(116), - static_cast<_Float16>(117), static_cast<_Float16>(118), - static_cast<_Float16>(119), static_cast<_Float16>(120)}; + _FP16 answer_data[] = {static_cast<_FP16>(1), static_cast<_FP16>(2), + static_cast<_FP16>(3), static_cast<_FP16>(4), + static_cast<_FP16>(5), static_cast<_FP16>(6), + static_cast<_FP16>(7), static_cast<_FP16>(8), + static_cast<_FP16>(9), static_cast<_FP16>(10), + static_cast<_FP16>(11), static_cast<_FP16>(12), + static_cast<_FP16>(13), static_cast<_FP16>(14), + static_cast<_FP16>(15), static_cast<_FP16>(16), + static_cast<_FP16>(17), static_cast<_FP16>(18), + static_cast<_FP16>(19), static_cast<_FP16>(20), + static_cast<_FP16>(21), static_cast<_FP16>(22), + static_cast<_FP16>(23), static_cast<_FP16>(24), + static_cast<_FP16>(25), static_cast<_FP16>(26), + static_cast<_FP16>(27), static_cast<_FP16>(28), + static_cast<_FP16>(29), static_cast<_FP16>(30), + static_cast<_FP16>(31), static_cast<_FP16>(32), + static_cast<_FP16>(33), static_cast<_FP16>(34), + static_cast<_FP16>(35), static_cast<_FP16>(36), + static_cast<_FP16>(37), static_cast<_FP16>(38), + static_cast<_FP16>(39), static_cast<_FP16>(40), + static_cast<_FP16>(41), static_cast<_FP16>(42), + static_cast<_FP16>(43), static_cast<_FP16>(44), + static_cast<_FP16>(45), static_cast<_FP16>(46), + static_cast<_FP16>(47), static_cast<_FP16>(48), + static_cast<_FP16>(49), static_cast<_FP16>(50), + static_cast<_FP16>(51), static_cast<_FP16>(52), + static_cast<_FP16>(53), static_cast<_FP16>(54), + static_cast<_FP16>(55), static_cast<_FP16>(56), + static_cast<_FP16>(57), static_cast<_FP16>(58), + static_cast<_FP16>(59), static_cast<_FP16>(60), + static_cast<_FP16>(61), static_cast<_FP16>(62), + static_cast<_FP16>(63), static_cast<_FP16>(64), + static_cast<_FP16>(65), static_cast<_FP16>(66), + static_cast<_FP16>(67), static_cast<_FP16>(68), + static_cast<_FP16>(69), static_cast<_FP16>(70), + static_cast<_FP16>(71), static_cast<_FP16>(72), + static_cast<_FP16>(73), static_cast<_FP16>(74), + static_cast<_FP16>(75), static_cast<_FP16>(76), + static_cast<_FP16>(77), static_cast<_FP16>(78), + static_cast<_FP16>(79), static_cast<_FP16>(80), + static_cast<_FP16>(81), static_cast<_FP16>(82), + static_cast<_FP16>(83), static_cast<_FP16>(84), + static_cast<_FP16>(85), static_cast<_FP16>(86), + static_cast<_FP16>(87), static_cast<_FP16>(88), + static_cast<_FP16>(89), static_cast<_FP16>(90), + static_cast<_FP16>(91), static_cast<_FP16>(92), + static_cast<_FP16>(93), static_cast<_FP16>(94), + static_cast<_FP16>(95), static_cast<_FP16>(96), + static_cast<_FP16>(97), static_cast<_FP16>(98), + static_cast<_FP16>(99), static_cast<_FP16>(100), + static_cast<_FP16>(101), static_cast<_FP16>(102), + static_cast<_FP16>(103), static_cast<_FP16>(104), + static_cast<_FP16>(105), static_cast<_FP16>(106), + static_cast<_FP16>(107), static_cast<_FP16>(108), + static_cast<_FP16>(109), static_cast<_FP16>(110), + static_cast<_FP16>(111), static_cast<_FP16>(112), + static_cast<_FP16>(113), static_cast<_FP16>(114), + static_cast<_FP16>(115), static_cast<_FP16>(116), + static_cast<_FP16>(117), static_cast<_FP16>(118), + static_cast<_FP16>(119), static_cast<_FP16>(120)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2808,37 +2787,27 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(3, 5, 1, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 1, 1, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0), static_cast<_Float16>(2), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(4), static_cast<_Float16>(6), - static_cast<_Float16>(8), static_cast<_Float16>(10), - static_cast<_Float16>(8), static_cast<_Float16>(10), - static_cast<_Float16>(12), static_cast<_Float16>(14), - static_cast<_Float16>(12), static_cast<_Float16>(14), - static_cast<_Float16>(16), static_cast<_Float16>(18), - static_cast<_Float16>(16), static_cast<_Float16>(18), - static_cast<_Float16>(20), static_cast<_Float16>(22), - static_cast<_Float16>(24), static_cast<_Float16>(26), - static_cast<_Float16>(28), static_cast<_Float16>(30), - static_cast<_Float16>(28), static_cast<_Float16>(30), - static_cast<_Float16>(32), static_cast<_Float16>(34), - static_cast<_Float16>(32), static_cast<_Float16>(34), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(36), static_cast<_Float16>(38), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(40), static_cast<_Float16>(42), - static_cast<_Float16>(44), static_cast<_Float16>(46), - static_cast<_Float16>(48), static_cast<_Float16>(50), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(52), static_cast<_Float16>(54), - static_cast<_Float16>(56), static_cast<_Float16>(58), - static_cast<_Float16>(56), static_cast<_Float16>(58), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(60), static_cast<_Float16>(62), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(64), static_cast<_Float16>(66), - static_cast<_Float16>(68), static_cast<_Float16>(70)}; + _FP16 answer_data[] = { + static_cast<_FP16>(0), static_cast<_FP16>(2), static_cast<_FP16>(4), + static_cast<_FP16>(6), static_cast<_FP16>(4), static_cast<_FP16>(6), + static_cast<_FP16>(8), static_cast<_FP16>(10), static_cast<_FP16>(8), + static_cast<_FP16>(10), static_cast<_FP16>(12), static_cast<_FP16>(14), + static_cast<_FP16>(12), static_cast<_FP16>(14), static_cast<_FP16>(16), + static_cast<_FP16>(18), static_cast<_FP16>(16), static_cast<_FP16>(18), + static_cast<_FP16>(20), static_cast<_FP16>(22), static_cast<_FP16>(24), + static_cast<_FP16>(26), static_cast<_FP16>(28), static_cast<_FP16>(30), + static_cast<_FP16>(28), static_cast<_FP16>(30), static_cast<_FP16>(32), + static_cast<_FP16>(34), static_cast<_FP16>(32), static_cast<_FP16>(34), + static_cast<_FP16>(36), static_cast<_FP16>(38), static_cast<_FP16>(36), + static_cast<_FP16>(38), static_cast<_FP16>(40), static_cast<_FP16>(42), + static_cast<_FP16>(40), static_cast<_FP16>(42), static_cast<_FP16>(44), + static_cast<_FP16>(46), static_cast<_FP16>(48), static_cast<_FP16>(50), + static_cast<_FP16>(52), static_cast<_FP16>(54), static_cast<_FP16>(52), + static_cast<_FP16>(54), static_cast<_FP16>(56), static_cast<_FP16>(58), + static_cast<_FP16>(56), static_cast<_FP16>(58), static_cast<_FP16>(60), + static_cast<_FP16>(62), static_cast<_FP16>(60), static_cast<_FP16>(62), + static_cast<_FP16>(64), static_cast<_FP16>(66), static_cast<_FP16>(64), + static_cast<_FP16>(66), static_cast<_FP16>(68), static_cast<_FP16>(70)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2851,8 +2820,7 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(1, 1, 2, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 1, 2, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = {static_cast<_Float16>(0.0), - static_cast<_Float16>(2.0)}; + _FP16 answer_data[] = {static_cast<_FP16>(0.0), static_cast<_FP16>(2.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2865,15 +2833,14 @@ TEST(nntrainer_Tensor, add_i_broadcast_01_p) { ranged(16, 1, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(1, 1, 1, 1, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { - static_cast<_Float16>(0.0), static_cast<_Float16>(1.0), - static_cast<_Float16>(2.0), static_cast<_Float16>(3.0), - static_cast<_Float16>(4.0), static_cast<_Float16>(5.0), - static_cast<_Float16>(6.0), static_cast<_Float16>(7.0), - static_cast<_Float16>(8.0), static_cast<_Float16>(9.0), - static_cast<_Float16>(10.0), static_cast<_Float16>(11.0), - static_cast<_Float16>(12.0), static_cast<_Float16>(13.0), - static_cast<_Float16>(14.0), static_cast<_Float16>(15.0)}; + _FP16 answer_data[] = {static_cast<_FP16>(0.0), static_cast<_FP16>(1.0), + static_cast<_FP16>(2.0), static_cast<_FP16>(3.0), + static_cast<_FP16>(4.0), static_cast<_FP16>(5.0), + static_cast<_FP16>(6.0), static_cast<_FP16>(7.0), + static_cast<_FP16>(8.0), static_cast<_FP16>(9.0), + static_cast<_FP16>(10.0), static_cast<_FP16>(11.0), + static_cast<_FP16>(12.0), static_cast<_FP16>(13.0), + static_cast<_FP16>(14.0), static_cast<_FP16>(15.0)}; nntrainer::Tensor answer(ref_dim, answer_data); int status = t.add_i(m); EXPECT_EQ(status, ML_ERROR_NONE); @@ -2912,13 +2879,13 @@ TEST(nntrainer_Tensor, add_01_p) { nntrainer::Tensor result = input.add(1.0); - _Float16 *data = result.getData<_Float16>(); + _FP16 *data = result.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width; ++i) { - if (data[i] != (_Float16)(indata[i] + (_Float16)1.0)) { + if (data[i] != (_FP16)(indata[i] + (_FP16)1.0)) { status = ML_ERROR_RESULT_OUT_OF_RANGE; break; } @@ -2940,9 +2907,9 @@ TEST(nntrainer_Tensor, add_02_p) { nntrainer::Tensor result = input.add(input); - _Float16 *data = result.getData<_Float16>(); + _FP16 *data = result.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width; ++i) { @@ -3096,7 +3063,7 @@ TEST(nntrainer_Tensor, pow_01_p) { // GEN_TEST_INPUT(input, k + l * 0.5 + 0.5); // nntrainer::Tensor actual = input.erf(); // nntrainer::Tensor expected( -// std::vector>>>( +// std::vector>>>( // {{{{0.5205, 0.8427}, {0.966105, 0.995322}}}}), // dim.getTensorType()); @@ -3122,13 +3089,13 @@ TEST(nntrainer_Tensor, subtract_i_01_p) { status = target.subtract_i(2.1); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *previous = original.getData<_Float16>(); + _FP16 *previous = original.getData<_FP16>(); ASSERT_NE(nullptr, previous); - _Float16 *data = target.getData<_Float16>(); + _FP16 *data = target.getData<_FP16>(); ASSERT_NE(nullptr, data); for (int i = 0; i < batch * height * width; ++i) { - EXPECT_FLOAT_EQ(data[i], ((_Float16)(previous[i] - (_Float16)2.1))); + EXPECT_FLOAT_EQ(data[i], ((_FP16)(previous[i] - (_FP16)2.1))); } } @@ -3147,7 +3114,7 @@ TEST(nntrainer_Tensor, subtract_i_02_p) { status = target.subtract_i(target); EXPECT_EQ(status, ML_ERROR_NONE); - _Float16 *data = target.getData<_Float16>(); + _FP16 *data = target.getData<_FP16>(); ASSERT_NE(nullptr, data); for (int i = 0; i < batch * height * width; ++i) { @@ -3188,9 +3155,9 @@ TEST(nntrainer_Tensor, subtract_01_p) { nntrainer::Tensor result = input.subtract(1.0); - _Float16 *data = result.getData<_Float16>(); + _FP16 *data = result.getData<_FP16>(); ASSERT_NE(nullptr, data); - _Float16 *indata = input.getData<_Float16>(); + _FP16 *indata = input.getData<_FP16>(); ASSERT_NE(nullptr, indata); for (int i = 0; i < batch * height * width; ++i) { @@ -3379,7 +3346,7 @@ TEST(nntrainer_Tensor, sum_02_p) { t_type.data_type = nntrainer::Tdatatype::FP16; nntrainer::Tensor ans0( - std::vector>>>( + std::vector>>>( {{{{39, 42, 45, 48, 51, 54, 57, 60, 63, 66}, {69, 72, 75, 78, 81, 84, 87, 90, 93, 96}}, {{57, 60, 63, 66, 69, 72, 75, 78, 81, 84}, @@ -3387,7 +3354,7 @@ TEST(nntrainer_Tensor, sum_02_p) { t_type); nntrainer::Tensor ans1( - std::vector>>>( + std::vector>>>( {{{{8, 10, 12, 14, 16, 18, 20, 22, 24, 26}, {28, 30, 32, 34, 36, 38, 40, 42, 44, 46}}}, {{{32, 34, 36, 38, 40, 42, 44, 46, 48, 50}, @@ -3397,7 +3364,7 @@ TEST(nntrainer_Tensor, sum_02_p) { t_type); nntrainer::Tensor ans2( - std::vector>>>( + std::vector>>>( {{{{12, 14, 16, 18, 20, 22, 24, 26, 28, 30}}, {{24, 26, 28, 30, 32, 34, 36, 38, 40, 42}}}, {{{36, 38, 40, 42, 44, 46, 48, 50, 52, 54}}, @@ -3407,7 +3374,7 @@ TEST(nntrainer_Tensor, sum_02_p) { t_type); nntrainer::Tensor ans3( - std::vector>>>( + std::vector>>>( {{{{55}, {155}}, {{115}, {215}}}, {{{175}, {275}}, {{235}, {335}}}, {{{295}, {395}}, {{355}, {455}}}}), @@ -3444,20 +3411,20 @@ TEST(nntrainer_Tensor, sum_03_p) { // Test for alpha == 1 and beta == 0 and dimension of reduced axis == 1 { nntrainer::Tensor ans_0_1_0( - std::vector>>>( + std::vector>>>( {{{{63, 66, 69, 72, 75, 78, 81, 84, 87, 90}}, {{93, 96, 99, 102, 105, 108, 111, 114, 117, 120}}}}), t_type); nntrainer::Tensor ans_1_1_0( - std::vector>>>( + std::vector>>>( {{{{12, 14, 16, 18, 20, 22, 24, 26, 28, 30}}}, {{{52, 54, 56, 58, 60, 62, 64, 66, 68, 70}}}, {{{92, 94, 96, 98, 100, 102, 104, 106, 108, 110}}}}), t_type); nntrainer::Tensor ans_2_1_0( - std::vector>>>( + std::vector>>>( {{{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}, {{11, 12, 13, 14, 15, 16, 17, 18, 19, 20}}}, {{{21, 22, 23, 24, 25, 26, 27, 28, 29, 30}}, @@ -3467,7 +3434,7 @@ TEST(nntrainer_Tensor, sum_03_p) { t_type); nntrainer::Tensor ans_3_1_0( - std::vector>>>( + std::vector>>>( {{{{55}}, {{155}}}, {{{255}}, {{355}}}, {{{455}}, {{555}}}}), t_type); @@ -3485,20 +3452,20 @@ TEST(nntrainer_Tensor, sum_03_p) { // Test for alpha == 1 and beta == 2 and dimension of reduced axis == 1 { nntrainer::Tensor ans_0_1_2( - std::vector>>>( + std::vector>>>( {{{{65, 70, 75, 80, 85, 90, 95, 100, 105, 110}}, {{115, 120, 125, 130, 135, 140, 145, 150, 155, 160}}}}), t_type); nntrainer::Tensor ans_1_1_2( - std::vector>>>( + std::vector>>>( {{{{14, 18, 22, 26, 30, 34, 38, 42, 46, 50}}}, {{{74, 78, 82, 86, 90, 94, 98, 102, 106, 110}}}, {{{134, 138, 142, 146, 150, 154, 158, 162, 166, 170}}}}), t_type); nntrainer::Tensor ans_2_1_2( - std::vector>>>( + std::vector>>>( {{{{3, 6, 9, 12, 15, 18, 21, 24, 27, 30}}, {{33, 36, 39, 42, 45, 48, 51, 54, 57, 60}}}, {{{63, 66, 69, 72, 75, 78, 81, 84, 87, 90}}, @@ -3508,7 +3475,7 @@ TEST(nntrainer_Tensor, sum_03_p) { t_type); nntrainer::Tensor ans_3_1_2( - std::vector>>>( + std::vector>>>( {{{{57}}, {{159}}}, {{{261}}, {{363}}}, {{{465}}, {{567}}}}), t_type); @@ -3554,20 +3521,20 @@ TEST(nntrainer_Tensor, sum_03_p) { // Test for alpha == 2 and beta == 0 { nntrainer::Tensor ans_0_2_0( - std::vector>>>( + std::vector>>>( {{{{126, 132, 138, 144, 150, 156, 162, 168, 174, 180}}, {{186, 192, 198, 204, 210, 216, 222, 228, 234, 240}}}}), t_type); nntrainer::Tensor ans_1_2_0( - std::vector>>>( + std::vector>>>( {{{{24, 28, 32, 36, 40, 44, 48, 52, 56, 60}}}, {{{104, 108, 112, 116, 120, 124, 128, 132, 136, 140}}}, {{{184, 188, 192, 196, 200, 204, 208, 212, 216, 220}}}}), t_type); nntrainer::Tensor ans_2_2_0( - std::vector>>>( + std::vector>>>( {{{{2, 4, 6, 8, 10, 12, 14, 16, 18, 20}}, {{22, 24, 26, 28, 30, 32, 34, 36, 38, 40}}}, {{{42, 44, 46, 48, 50, 52, 54, 56, 58, 60}}, @@ -3577,7 +3544,7 @@ TEST(nntrainer_Tensor, sum_03_p) { t_type); nntrainer::Tensor ans_3_2_0( - std::vector>>>( + std::vector>>>( {{{{110}}, {{310}}}, {{{510}}, {{710}}}, {{{910}}, {{1110}}}}), t_type); @@ -3595,20 +3562,20 @@ TEST(nntrainer_Tensor, sum_03_p) { // Test for alpha == 2 and beta == 2 { nntrainer::Tensor ans_0_2_2( - std::vector>>>( + std::vector>>>( {{{{128, 136, 144, 152, 160, 168, 176, 184, 192, 200}}, {{208, 216, 224, 232, 240, 248, 256, 264, 272, 280}}}}), t_type); nntrainer::Tensor ans_1_2_2( - std::vector>>>( + std::vector>>>( {{{{26, 32, 38, 44, 50, 56, 62, 68, 74, 80}}}, {{{126, 132, 138, 144, 150, 156, 162, 168, 174, 180}}}, {{{226, 232, 238, 244, 250, 256, 262, 268, 274, 280}}}}), t_type); nntrainer::Tensor ans_2_2_2( - std::vector>>>( + std::vector>>>( {{{{4, 8, 12, 16, 20, 24, 28, 32, 36, 40}}, {{44, 48, 52, 56, 60, 64, 68, 72, 76, 80}}}, {{{84, 88, 92, 96, 100, 104, 108, 112, 116, 120}}, @@ -3618,7 +3585,7 @@ TEST(nntrainer_Tensor, sum_03_p) { t_type); nntrainer::Tensor ans_3_2_2( - std::vector>>>( + std::vector>>>( {{{{112}}, {{314}}}, {{{516}}, {{718}}}, {{{920}}, {{1122}}}}), t_type); @@ -3678,9 +3645,9 @@ TEST(nntrainer_Tensor, sum_04_p) { k * width + l + 1); nntrainer::Tensor result = input.sum_by_batch(); - if (result.getValue<_Float16>(0, 0, 0, 0) != 820 || - result.getValue<_Float16>(1, 0, 0, 0) != 1300 || - result.getValue<_Float16>(2, 0, 0, 0) != 1780) + if (result.getValue<_FP16>(0, 0, 0, 0) != 820 || + result.getValue<_FP16>(1, 0, 0, 0) != 1300 || + result.getValue<_FP16>(2, 0, 0, 0) != 1780) status = ML_ERROR_RESULT_OUT_OF_RANGE; EXPECT_EQ(status, ML_ERROR_NONE); @@ -3731,7 +3698,8 @@ TEST(nntrainer_Tensor, multiple_sum_p) { // nntrainer::Tdatatype::FP16); // nntrainer::Tensor actual, expected; -// actual.setTensorType({nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16}); +// actual.setTensorType({nntrainer::Tformat::NCHW, +// nntrainer::Tdatatype::FP16}); // actual = t.average(); // expected = constant(1.0, 1, 1, 1, 1, nntrainer::Tformat::NCHW, @@ -3740,7 +3708,7 @@ TEST(nntrainer_Tensor, multiple_sum_p) { // int idx = 0; // t = t.apply( -// (std::function<_Float16(_Float16)>)[&](_Float16 in) { return idx++ % 2; }); +// (std::function<_FP16(_FP16)>)[&](_FP16 in) { return idx++ % 2; }); // actual = t.average(); // expected = constant(0.5, 1, 1, 1, 1, nntrainer::Tformat::NCHW, @@ -3895,7 +3863,7 @@ TEST(nntrainer_Tensor, dot_05_p) { t_type.format = nntrainer::Tformat::NCHW; t_type.data_type = nntrainer::Tdatatype::FP16; - _Float16 ans[2][3][4][24] = {0}; + _FP16 ans[2][3][4][24] = {0}; nntrainer::Tensor input(batch, channel, height, width, t_type); GEN_TEST_INPUT(input, i * (channel * width * height) + j * (height * width) + @@ -3913,8 +3881,8 @@ TEST(nntrainer_Tensor, dot_05_p) { for (int k = 0; k < batch * channel * height; k++) { ans[b][c][h][k] = 0; for (int w = 0; w < width; w++) { - _Float16 val1 = input.getValue<_Float16>(b, c, h, w); - _Float16 val2 = weight.getValue<_Float16>(0, 0, k, w); + _FP16 val1 = input.getValue<_FP16>(b, c, h, w); + _FP16 val2 = weight.getValue<_FP16>(0, 0, k, w); ans[b][c][h][k] += val1 * val2; } } @@ -3926,8 +3894,8 @@ TEST(nntrainer_Tensor, dot_05_p) { for (unsigned int c = 0; c < result.channel(); ++c) { for (unsigned int j = 0; j < result.height(); ++j) { for (unsigned int k = 0; k < result.width(); ++k) { - _Float16 val1 = ans[i][c][j][k]; - _Float16 val2 = result.getValue<_Float16>(i, c, j, k); + _FP16 val1 = ans[i][c][j][k]; + _FP16 val2 = result.getValue<_FP16>(i, c, j, k); if (val1 != val2) { status = ML_ERROR_RESULT_OUT_OF_RANGE; goto end_dot_01_p; @@ -3951,7 +3919,7 @@ TEST(nntrainer_Tensor, dot_06_p) { t_type.format = nntrainer::Tformat::NCHW; t_type.data_type = nntrainer::Tdatatype::FP16; - _Float16 ans[3][1][1][3] = { + _FP16 ans[3][1][1][3] = { {{{30, 36, 42}}}, {{{66, 81, 96}}}, {{{102, 126, 150}}}}; nntrainer::Tensor input(batch, channel, height, width, t_type); @@ -3963,7 +3931,7 @@ TEST(nntrainer_Tensor, dot_06_p) { for (unsigned int i = 0; i < result.batch(); ++i) { for (unsigned int j = 0; j < result.height(); ++j) { for (unsigned int k = 0; k < result.width(); ++k) { - if (ans[i][0][j][k] != result.getValue<_Float16>(i, 0, j, k)) { + if (ans[i][0][j][k] != result.getValue<_FP16>(i, 0, j, k)) { status = ML_ERROR_RESULT_OUT_OF_RANGE; goto end_dot_01_p; } @@ -3979,180 +3947,180 @@ TEST(nntrainer_Tensor, dot_transpose_p) { t_type.format = nntrainer::Tformat::NCHW; t_type.data_type = nntrainer::Tdatatype::FP16; { - _Float16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + _FP16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 4, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, - 92, 113, 134, 155, 128, 158, 188, 218}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, + 92, 113, 134, 155, 128, 158, 188, 218}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + _FP16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 4, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, - 92, 113, 134, 155, 128, 158, 188, 218}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, + 92, 113, 134, 155, 128, 158, 188, 218}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 4, 3, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, - 92, 113, 134, 155, 128, 158, 188, 218}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, + 92, 113, 134, 155, 128, 158, 188, 218}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 4, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, - 92, 113, 134, 155, 128, 158, 188, 218}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92, + 92, 113, 134, 155, 128, 158, 188, 218}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 1, 4, 2, 5}; + _FP16 a_data[] = {0, 3, 1, 4, 2, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 2, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 1, 4, 2, 5}; + _FP16 a_data[] = {0, 3, 1, 4, 2, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 2, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 2, 3, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 2, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; + _FP16 answer_data[] = {20, 23, 26, 29, 56, 68, 80, 92}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + _FP16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 4, t_type), a_data); - _Float16 b_data[] = {0, 2, 4, 1, 3, 5}; + _FP16 b_data[] = {0, 2, 4, 1, 3, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 2, 3, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; + _FP16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + _FP16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 4, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 2, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; + _FP16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 4, 3, t_type), a_data); - _Float16 b_data[] = {0, 2, 4, 1, 3, 5}; + _FP16 b_data[] = {0, 2, 4, 1, 3, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 2, 3, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; + _FP16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 4, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 2, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; + _FP16 answer_data[] = {10, 13, 28, 40, 46, 67, 64, 94}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 1, 4, 2, 5}; + _FP16 a_data[] = {0, 3, 1, 4, 2, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 2, t_type), a_data); - _Float16 b_data[] = {0, 2, 4, 1, 3, 5}; + _FP16 b_data[] = {0, 2, 4, 1, 3, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 2, 3, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40}; + _FP16 answer_data[] = {10, 13, 28, 40}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 1, 4, 2, 5}; + _FP16 a_data[] = {0, 3, 1, 4, 2, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 2, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 2, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40}; + _FP16 answer_data[] = {10, 13, 28, 40}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 2, 3, t_type), a_data); - _Float16 b_data[] = {0, 2, 4, 1, 3, 5}; + _FP16 b_data[] = {0, 2, 4, 1, 3, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 2, 3, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40}; + _FP16 answer_data[] = {10, 13, 28, 40}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 2, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 2, t_type), b_data); - _Float16 answer_data[] = {10, 13, 28, 40}; + _FP16 answer_data[] = {10, 13, 28, 40}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); @@ -4165,264 +4133,264 @@ TEST(nntrainer_Tensor, dot_shortcuts_p) { t_type.format = nntrainer::Tformat::NCHW; t_type.data_type = nntrainer::Tdatatype::FP16; { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 1, t_type), b_data); - _Float16 answer_data[] = {5}; + _FP16 answer_data[] = {5}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 1, t_type), b_data); - _Float16 answer_data[] = {5}; + _FP16 answer_data[] = {5}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 1, 3, t_type), b_data); - _Float16 answer_data[] = {5}; + _FP16 answer_data[] = {5}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 1, 3, t_type), b_data); - _Float16 answer_data[] = {5}; + _FP16 answer_data[] = {5}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 2, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 1, t_type), b_data); - _Float16 answer_data[] = {5, 14}; + _FP16 answer_data[] = {5, 14}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 1, 4, 2, 5}; + _FP16 a_data[] = {0, 3, 1, 4, 2, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 2, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 1, t_type), b_data); - _Float16 answer_data[] = {5, 14}; + _FP16 answer_data[] = {5, 14}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 2, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 1, 3, t_type), b_data); - _Float16 answer_data[] = {5, 14}; + _FP16 answer_data[] = {5, 14}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 1, 4, 2, 5}; + _FP16 a_data[] = {0, 3, 1, 4, 2, 5}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 2, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 1, 3, t_type), b_data); - _Float16 answer_data[] = {5, 14}; + _FP16 answer_data[] = {5, 14}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 2, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 4, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 1, t_type), b_data); - _Float16 answer_data[] = {5, 14, 23, 32}; + _FP16 answer_data[] = {5, 14, 23, 32}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + _FP16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 4, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 1, t_type), b_data); - _Float16 answer_data[] = {5, 14, 23, 32}; + _FP16 answer_data[] = {5, 14, 23, 32}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 a_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 4, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 1, 3, t_type), b_data); - _Float16 answer_data[] = {5, 14, 23, 32}; + _FP16 answer_data[] = {5, 14, 23, 32}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; + _FP16 a_data[] = {0, 3, 6, 9, 1, 4, 7, 10, 2, 5, 8, 11}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 4, t_type), a_data); - _Float16 b_data[] = {0, 1, 2}; + _FP16 b_data[] = {0, 1, 2}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 1, 3, t_type), b_data); - _Float16 answer_data[] = {5, 14, 23, 32}; + _FP16 answer_data[] = {5, 14, 23, 32}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 4, 1, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 4, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; + _FP16 b_data[] = {0, 4, 8, 1, 5, 9, 2, 6, 10, 3, 7, 11}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 4, 3, t_type), b_data); - _Float16 answer_data[] = {20, 23, 26, 29}; + _FP16 answer_data[] = {20, 23, 26, 29}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 4, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 2, t_type), b_data); - _Float16 answer_data[] = {10, 13}; + _FP16 answer_data[] = {10, 13}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 1, 2, 3, 4, 5}; + _FP16 b_data[] = {0, 1, 2, 3, 4, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 3, 2, t_type), b_data); - _Float16 answer_data[] = {10, 13}; + _FP16 answer_data[] = {10, 13}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, false); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 1, 3, t_type), a_data); - _Float16 b_data[] = {0, 2, 4, 1, 3, 5}; + _FP16 b_data[] = {0, 2, 4, 1, 3, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 2, 3, t_type), b_data); - _Float16 answer_data[] = {10, 13}; + _FP16 answer_data[] = {10, 13}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, false, true); EXPECT_EQ(ret, answer); } { - _Float16 a_data[] = {0, 1, 2}; + _FP16 a_data[] = {0, 1, 2}; nntrainer::Tensor a(nntrainer::TensorDim(1, 1, 3, 1, t_type), a_data); - _Float16 b_data[] = {0, 2, 4, 1, 3, 5}; + _FP16 b_data[] = {0, 2, 4, 1, 3, 5}; nntrainer::Tensor b(nntrainer::TensorDim(1, 1, 2, 3, t_type), b_data); - _Float16 answer_data[] = {10, 13}; + _FP16 answer_data[] = {10, 13}; nntrainer::Tensor answer(nntrainer::TensorDim(1, 1, 1, 2, t_type), answer_data); nntrainer::Tensor ret = a.dot(b, true, true); @@ -4442,7 +4410,7 @@ TEST(nntrainer_Tensor, transpose_p) { nntrainer::TensorDim ref_dim(3, 2, 4, 5, t_type); nntrainer::Tensor t = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, @@ -4460,7 +4428,7 @@ TEST(nntrainer_Tensor, transpose_p) { nntrainer::TensorDim ref_dim(3, 2, 4, 5, t_type); nntrainer::Tensor t = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 5, 10, 15, 1, 6, 11, 16, 2, 7, 12, 17, 3, 8, 13, 18, 4, 9, 14, 19, 20, 25, 30, 35, 21, 26, 31, 36, 22, 27, 32, 37, 23, 28, 33, 38, 24, 29, 34, 39, 40, 45, @@ -4478,7 +4446,7 @@ TEST(nntrainer_Tensor, transpose_p) { nntrainer::TensorDim ref_dim(3, 2, 4, 5, t_type); nntrainer::Tensor t = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 20, 21, 22, 23, 24, 5, 6, 7, 8, 9, 25, 26, 27, 28, 29, 10, 11, 12, 13, 14, 30, 31, 32, 33, 34, 15, 16, 17, 18, 19, 35, 36, 37, 38, 39, 40, 41, @@ -4496,7 +4464,7 @@ TEST(nntrainer_Tensor, transpose_p) { nntrainer::TensorDim ref_dim(3, 2, 4, 5, t_type); nntrainer::Tensor t = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 20, 1, 21, 2, 22, 3, 23, 4, 24, 5, 25, 6, 26, 7, 27, 8, 28, 9, 29, 10, 30, 11, 31, 12, 32, 13, 33, 14, 34, 15, 35, 16, 36, 17, 37, 18, 38, 19, 39, 40, 60, 41, 61, 42, 62, 43, 63, @@ -4513,7 +4481,7 @@ TEST(nntrainer_Tensor, transpose_p) { nntrainer::TensorDim ref_dim(3, 2, 4, 5, t_type); nntrainer::Tensor t = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 5, 10, 15, 20, 25, 30, 35, 1, 6, 11, 16, 21, 26, 31, 36, 2, 7, 12, 17, 22, 27, 32, 37, 3, 8, 13, 18, 23, 28, 33, 38, 4, 9, 14, 19, 24, 29, 34, 39, 40, 45, 50, 55, 60, @@ -4530,7 +4498,7 @@ TEST(nntrainer_Tensor, transpose_p) { nntrainer::TensorDim ref_dim(3, 2, 4, 5, t_type); nntrainer::Tensor t = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 20, 5, 25, 10, 30, 15, 35, 1, 21, 6, 26, 11, 31, 16, 36, 2, 22, 7, 27, 12, 32, 17, 37, 3, 23, 8, 28, 13, 33, 18, 38, 4, 24, 9, 29, 14, 34, 19, 39, 40, 60, 45, 65, 50, 70, 55, 75, @@ -4551,7 +4519,7 @@ TEST(nntrainer_Tensor, transpose_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, @@ -4571,7 +4539,7 @@ TEST(nntrainer_Tensor, transpose_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 2, 5, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 5, 10, 15, 1, 6, 11, 16, 2, 7, 12, 17, 3, 8, 13, 18, 4, 9, 14, 19, 20, 25, 30, 35, 21, 26, 31, 36, 22, 27, 32, 37, 23, 28, 33, 38, 24, 29, 34, 39, 40, 45, @@ -4591,7 +4559,7 @@ TEST(nntrainer_Tensor, transpose_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 4, 2, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 20, 21, 22, 23, 24, 5, 6, 7, 8, 9, 25, 26, 27, 28, 29, 10, 11, 12, 13, 14, 30, 31, 32, 33, 34, 15, 16, 17, 18, 19, 35, 36, 37, 38, 39, 40, 41, @@ -4611,7 +4579,7 @@ TEST(nntrainer_Tensor, transpose_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 4, 5, 2, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 20, 1, 21, 2, 22, 3, 23, 4, 24, 5, 25, 6, 26, 7, 27, 8, 28, 9, 29, 10, 30, 11, 31, 12, 32, 13, 33, 14, 34, 15, 35, 16, 36, 17, 37, 18, 38, 19, 39, 40, 60, 41, 61, 42, 62, 43, 63, @@ -4630,7 +4598,7 @@ TEST(nntrainer_Tensor, transpose_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 5, 2, 4, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 5, 10, 15, 20, 25, 30, 35, 1, 6, 11, 16, 21, 26, 31, 36, 2, 7, 12, 17, 22, 27, 32, 37, 3, 8, 13, 18, 23, 28, 33, 38, 4, 9, 14, 19, 24, 29, 34, 39, 40, 45, 50, 55, 60, @@ -4649,7 +4617,7 @@ TEST(nntrainer_Tensor, transpose_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); nntrainer::Tensor m = ranged(3, 5, 4, 2, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 20, 5, 25, 10, 30, 15, 35, 1, 21, 6, 26, 11, 31, 16, 36, 2, 22, 7, 27, 12, 32, 17, 37, 3, 23, 8, 28, 13, 33, 18, 38, 4, 24, 9, 29, 14, 34, 19, 39, 40, 60, 45, 65, 50, 70, 55, 75, @@ -4683,13 +4651,13 @@ TEST(nntrainer_Tensor, tranpose_dimension_not_match_n) { // nntrainer::Tensor tensor = nntrainer::Tensor(1, 1, 1, 1, t_type); // tensor.setZero(); -// EXPECT_EQ(tensor.getValue<_Float16>(0, 0, 0, 0), 0.0); +// EXPECT_EQ(tensor.getValue<_FP16>(0, 0, 0, 0), 0.0); // tensor.setRandUniform(-0.5, 0.0); -// std::cout << "val : " << (float)tensor.getValue<_Float16>(0, 0, 0, 0) +// std::cout << "val : " << (float)tensor.getValue<_FP16>(0, 0, 0, 0) // << std::endl; -// _Float16 val = tensor.getValue<_Float16>(0, 0, 0, 0); +// _FP16 val = tensor.getValue<_FP16>(0, 0, 0, 0); // EXPECT_TRUE(val >= -0.5 && val < 0); // } @@ -4845,7 +4813,7 @@ TEST(nntrainer_Tensor, print_small_size) { ss << target; expected << '<' << typeid(target).name() << " at " << &target << ">\n" - << "data addr: " << target.getData<_Float16>() << '\n' + << "data addr: " << target.getData<_FP16>() << '\n' << "Shape: 3:1:2:3 [ FP16 : NCHW ]\n" << " 1 1 1 \n" << " 1 1 1 \n" @@ -4870,7 +4838,7 @@ TEST(nntrainer_Tensor, print_large_size) { std::stringstream ss, expected; expected << '<' << typeid(target).name() << " at " << &target << ">\n" - << "data addr: " << target.getData<_Float16>() << '\n' + << "data addr: " << target.getData<_FP16>() << '\n' << "Shape: 3:10:10:10 [ FP16 : NCHW ]\n" << "[1.2002 1.2002 1.2002 ... 1.2002 1.2002 1.2002]\n"; ss << target; @@ -4889,8 +4857,8 @@ TEST(nntrainer_Tensor, print_large_size) { // ret1 = a.subtract(b).multiply(c); // ret2 = a.multiply(c).subtract(b.multiply(c)); -// _Float16 *data1 = ret1.getData<_Float16>(); -// _Float16 *data2 = ret2.getData<_Float16>(); +// _FP16 *data1 = ret1.getData<_FP16>(); +// _FP16 *data2 = ret2.getData<_FP16>(); // EXPECT_EQ(ret1, ret2); // for (unsigned int i = 0; i < ret1.size(); ++i) { @@ -5150,7 +5118,7 @@ TEST(nntrainer_Tensor, initialize_08_p) { EXPECT_EQ(golden, t); /// @todo this test case is not valid anymore, since - /// std::uniform_real_distribution does not support _Float16 + /// std::uniform_real_distribution does not support _FP16 // t.initialize(nntrainer::Tensor::Initializer::HE_NORMAL); // EXPECT_NE(golden, t); // t.initialize(); @@ -5174,26 +5142,26 @@ TEST(nntrainer_Tensor, split_01_p) { std::vector answer; answer.reserve(3); { - _Float16 answer_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}; + _FP16 answer_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39}; answer.emplace_back(ml::train::TensorDim{1, 2, 4, 5, t_type}, answer_data); } { - _Float16 answer_data[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79}; + _FP16 answer_data[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79}; answer.emplace_back(ml::train::TensorDim{1, 2, 4, 5, t_type}, answer_data); } { - _Float16 answer_data[] = { - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; + _FP16 answer_data[] = {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; answer.emplace_back(ml::train::TensorDim{1, 2, 4, 5, t_type}, answer_data); } @@ -5206,21 +5174,21 @@ TEST(nntrainer_Tensor, split_01_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99}; + _FP16 answer_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99}; answer.emplace_back(ml::train::TensorDim{3, 1, 4, 5, t_type}, answer_data); } { - _Float16 answer_data[] = { - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; + _FP16 answer_data[] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; answer.emplace_back(ml::train::TensorDim{3, 1, 4, 5, t_type}, answer_data); } @@ -5233,7 +5201,7 @@ TEST(nntrainer_Tensor, split_01_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 81, 82, 83, 84, @@ -5242,7 +5210,7 @@ TEST(nntrainer_Tensor, split_01_p) { answer_data); } { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 90, 91, 92, 93, 94, @@ -5259,37 +5227,37 @@ TEST(nntrainer_Tensor, split_01_p) { std::vector answer; answer.reserve(5); { - _Float16 answer_data[] = {0, 5, 10, 15, 20, 25, 30, 35, - 40, 45, 50, 55, 60, 65, 70, 75, - 80, 85, 90, 95, 100, 105, 110, 115}; + _FP16 answer_data[] = {0, 5, 10, 15, 20, 25, 30, 35, + 40, 45, 50, 55, 60, 65, 70, 75, + 80, 85, 90, 95, 100, 105, 110, 115}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } { - _Float16 answer_data[] = {1, 6, 11, 16, 21, 26, 31, 36, - 41, 46, 51, 56, 61, 66, 71, 76, - 81, 86, 91, 96, 101, 106, 111, 116}; + _FP16 answer_data[] = {1, 6, 11, 16, 21, 26, 31, 36, + 41, 46, 51, 56, 61, 66, 71, 76, + 81, 86, 91, 96, 101, 106, 111, 116}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } { - _Float16 answer_data[] = {2, 7, 12, 17, 22, 27, 32, 37, - 42, 47, 52, 57, 62, 67, 72, 77, - 82, 87, 92, 97, 102, 107, 112, 117}; + _FP16 answer_data[] = {2, 7, 12, 17, 22, 27, 32, 37, + 42, 47, 52, 57, 62, 67, 72, 77, + 82, 87, 92, 97, 102, 107, 112, 117}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } { - _Float16 answer_data[] = {3, 8, 13, 18, 23, 28, 33, 38, - 43, 48, 53, 58, 63, 68, 73, 78, - 83, 88, 93, 98, 103, 108, 113, 118}; + _FP16 answer_data[] = {3, 8, 13, 18, 23, 28, 33, 38, + 43, 48, 53, 58, 63, 68, 73, 78, + 83, 88, 93, 98, 103, 108, 113, 118}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } { - _Float16 answer_data[] = {4, 9, 14, 19, 24, 29, 34, 39, - 44, 49, 54, 59, 64, 69, 74, 79, - 84, 89, 94, 99, 104, 109, 114, 119}; + _FP16 answer_data[] = {4, 9, 14, 19, 24, 29, 34, 39, + 44, 49, 54, 59, 64, 69, 74, 79, + 84, 89, 94, 99, 104, 109, 114, 119}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } @@ -5302,12 +5270,12 @@ TEST(nntrainer_Tensor, split_01_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = {0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20}; + _FP16 answer_data[] = {0, 1, 2, 6, 7, 8, 12, 13, 14, 18, 19, 20}; answer.emplace_back(ml::train::TensorDim{1, 1, 4, 3, t_type}, answer_data); } { - _Float16 answer_data[] = {3, 4, 5, 9, 10, 11, 15, 16, 17, 21, 22, 23}; + _FP16 answer_data[] = {3, 4, 5, 9, 10, 11, 15, 16, 17, 21, 22, 23}; answer.emplace_back(ml::train::TensorDim{1, 1, 4, 3, t_type}, answer_data); } @@ -5344,7 +5312,7 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, @@ -5354,10 +5322,10 @@ TEST(nntrainer_Tensor, split_04_p) { answer_data); } { - _Float16 answer_data[] = { - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; + _FP16 answer_data[] = {80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; answer.emplace_back(ml::train::TensorDim{1, 2, 4, 5, t_type}, answer_data); } @@ -5370,21 +5338,21 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 58, 59, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99}; + _FP16 answer_data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 58, 59, 80, 81, 82, 83, 84, 85, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99}; answer.emplace_back(ml::train::TensorDim{3, 1, 4, 5, t_type}, answer_data); } { - _Float16 answer_data[] = { - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 76, 77, 78, 79, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; + _FP16 answer_data[] = {20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119}; answer.emplace_back(ml::train::TensorDim{3, 1, 4, 5, t_type}, answer_data); } @@ -5397,7 +5365,7 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 80, 81, 82, 83, 84, @@ -5406,7 +5374,7 @@ TEST(nntrainer_Tensor, split_04_p) { answer_data); } { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 90, 91, 92, 93, 94, @@ -5423,14 +5391,14 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(3); { - _Float16 answer_data[] = {0, 5, 10, 15, 20, 25, 30, 35, - 40, 45, 50, 55, 60, 65, 70, 75, - 80, 85, 90, 95, 100, 105, 110, 115}; + _FP16 answer_data[] = {0, 5, 10, 15, 20, 25, 30, 35, + 40, 45, 50, 55, 60, 65, 70, 75, + 80, 85, 90, 95, 100, 105, 110, 115}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 1, 2, 3, 6, 7, 8, 11, 12, 13, 16, 17, 18, 21, 22, 23, 26, 27, 28, 31, 32, 33, 36, 37, 38, 41, 42, 43, 46, 47, 48, 51, 52, 53, 56, 57, 58, 61, 62, 63, 66, 67, 68, 71, 72, 73, @@ -5440,9 +5408,9 @@ TEST(nntrainer_Tensor, split_04_p) { answer_data); } { - _Float16 answer_data[] = {4, 9, 14, 19, 24, 29, 34, 39, - 44, 49, 54, 59, 64, 69, 74, 79, - 84, 89, 94, 99, 104, 109, 114, 119}; + _FP16 answer_data[] = {4, 9, 14, 19, 24, 29, 34, 39, + 44, 49, 54, 59, 64, 69, 74, 79, + 84, 89, 94, 99, 104, 109, 114, 119}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } @@ -5455,7 +5423,7 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(3); { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 5, 6, 10, 11, 15, 16, 20, 21, 25, 26, 30, 31, 35, 36, 40, 41, 45, 46, 50, 51, 55, 56, 60, 61, 65, 66, 70, 71, 75, 76, 80, 81, 85, 86, 90, 91, 95, 96, 100, 101, 105, 106, 110, 111, 115, 116}; @@ -5463,7 +5431,7 @@ TEST(nntrainer_Tensor, split_04_p) { answer_data); } { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 2, 3, 7, 8, 12, 13, 17, 18, 22, 23, 27, 28, 32, 33, 37, 38, 42, 43, 47, 48, 52, 53, 57, 58, 62, 63, 67, 68, 72, 73, 77, 78, 82, 83, 87, 88, 92, 93, 97, 98, 102, 103, 107, 108, 112, 113, 117, 118}; @@ -5471,9 +5439,9 @@ TEST(nntrainer_Tensor, split_04_p) { answer_data); } { - _Float16 answer_data[] = {4, 9, 14, 19, 24, 29, 34, 39, - 44, 49, 54, 59, 64, 69, 74, 79, - 84, 89, 94, 99, 104, 109, 114, 119}; + _FP16 answer_data[] = {4, 9, 14, 19, 24, 29, 34, 39, + 44, 49, 54, 59, 64, 69, 74, 79, + 84, 89, 94, 99, 104, 109, 114, 119}; answer.emplace_back(ml::train::TensorDim{3, 2, 4, 1, t_type}, answer_data); } @@ -5486,7 +5454,7 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(2); { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 5, 6, 10, 11, 15, 16, 20, 21, 25, 26, 30, 31, 35, 36, 40, 41, 45, 46, 50, 51, 55, 56, 60, 61, 65, 66, 70, 71, 75, 76, 80, 81, 85, 86, 90, 91, 95, 96, 100, 101, 105, 106, 110, 111, 115, 116}; @@ -5494,7 +5462,7 @@ TEST(nntrainer_Tensor, split_04_p) { answer_data); } { - _Float16 answer_data[] = { + _FP16 answer_data[] = { 2, 3, 4, 7, 8, 9, 12, 13, 14, 17, 18, 19, 22, 23, 24, 27, 28, 29, 32, 33, 34, 37, 38, 39, 42, 43, 44, 47, 48, 49, 52, 53, 54, 57, 58, 59, 62, 63, 64, 67, 68, 69, 72, 73, 74, @@ -5512,17 +5480,17 @@ TEST(nntrainer_Tensor, split_04_p) { std::vector answer; answer.reserve(3); { - _Float16 answer_data[] = {0, 6, 12, 18}; + _FP16 answer_data[] = {0, 6, 12, 18}; answer.emplace_back(ml::train::TensorDim{1, 1, 4, 1, t_type}, answer_data); } { - _Float16 answer_data[] = {1, 2, 3, 7, 8, 9, 13, 14, 15, 19, 20, 21}; + _FP16 answer_data[] = {1, 2, 3, 7, 8, 9, 13, 14, 15, 19, 20, 21}; answer.emplace_back(ml::train::TensorDim{1, 1, 4, 3, t_type}, answer_data); } { - _Float16 answer_data[] = {4, 5, 10, 11, 16, 17, 22, 23}; + _FP16 answer_data[] = {4, 5, 10, 11, 16, 17, 22, 23}; answer.emplace_back(ml::train::TensorDim{1, 1, 4, 2, t_type}, answer_data); } @@ -5568,7 +5536,7 @@ TEST(nntrainer_Tensor, cat_01_p) { ranged(2, 1, 1, 2, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); inputs.emplace_back( ranged(2, 2, 1, 2, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); - _Float16 answer_data[] = {0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 6, 7}; + _FP16 answer_data[] = {0, 1, 0, 1, 2, 3, 2, 3, 4, 5, 6, 7}; nntrainer::Tensor answer(ml::train::TensorDim{2, 3, 1, 2, t_type}, answer_data); EXPECT_EQ(nntrainer::Tensor::cat(inputs, 1), answer); @@ -5580,7 +5548,7 @@ TEST(nntrainer_Tensor, cat_01_p) { ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); inputs.emplace_back( ranged(2, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, @@ -5606,7 +5574,7 @@ TEST(nntrainer_Tensor, cat_01_p) { ranged(3, 3, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); inputs.emplace_back( ranged(3, 2, 4, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, @@ -5640,7 +5608,7 @@ TEST(nntrainer_Tensor, cat_01_p) { ranged(3, 2, 1, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); inputs.emplace_back( ranged(3, 2, 2, 5, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 15, 16, 17, 18, 19, 30, 31, 32, 33, @@ -5659,7 +5627,7 @@ TEST(nntrainer_Tensor, cat_01_p) { ranged(3, 2, 4, 3, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); inputs.emplace_back( ranged(3, 2, 4, 2, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16)); - _Float16 answer_data[] = { + _FP16 answer_data[] = { 0, 0, 1, 2, 0, 1, 1, 3, 4, 5, 2, 3, 2, 6, 7, 8, 4, 5, 3, 9, 10, 11, 6, 7, 4, 12, 13, 14, 8, 9, 5, 15, 16, 17, 10, 11, 6, 18, 19, 20, 12, 13, 7, 21, 22, 23, 14, 15, 8, 24, 25, 26, 16, 17, @@ -5711,16 +5679,15 @@ TEST(nntrainer_Tensor, zoneout_mask_02_p) { EXPECT_EQ(t.size(), opposite.size()); - auto is_near = [epsilon](_Float16 val1, _Float16 val2) { + auto is_near = [epsilon](_FP16 val1, _FP16 val2) { return val2 - epsilon < val1 && val1 < val2 + epsilon; }; for (unsigned int i = 0; i < opposite.size(); ++i) { - if (is_near(opposite.getValue<_Float16>(i), static_cast<_Float16>(0.0f))) { - EXPECT_NEAR(t.getValue<_Float16>(i), 1.0f, epsilon); - } else if (is_near(opposite.getValue<_Float16>(i), - static_cast<_Float16>(1.0f))) { - EXPECT_NEAR(t.getValue<_Float16>(i), 0.0f, epsilon); + if (is_near(opposite.getValue<_FP16>(i), static_cast<_FP16>(0.0f))) { + EXPECT_NEAR(t.getValue<_FP16>(i), 1.0f, epsilon); + } else if (is_near(opposite.getValue<_FP16>(i), static_cast<_FP16>(1.0f))) { + EXPECT_NEAR(t.getValue<_FP16>(i), 0.0f, epsilon); } else { FAIL() << "This should not be happen"; } @@ -5737,7 +5704,7 @@ TEST(nntrainer_Tensor, zoneout_mask_03_p) { nntrainer::Tensor opposite = t.zoneout_mask(zoneout_rate); constexpr float epsilon = 1e-3; - auto is_near = [epsilon](_Float16 val1, _Float16 val2) { + auto is_near = [epsilon](_FP16 val1, _FP16 val2) { return val2 - epsilon < val1 && val1 < val2 + epsilon; }; auto percentage = [](unsigned int dividend, unsigned int divisor) { @@ -5748,10 +5715,10 @@ TEST(nntrainer_Tensor, zoneout_mask_03_p) { unsigned int zeros = 0; unsigned int ones = 0; for (unsigned int i = 0; i < opposite.size(); ++i) { - if (is_near(opposite.getValue<_Float16>(i), static_cast<_Float16>(0.0))) { + if (is_near(opposite.getValue<_FP16>(i), static_cast<_FP16>(0.0))) { ++zeros; - } else if (is_near(opposite.getValue<_Float16>(i), - static_cast<_Float16>(1.0))) { + } else if (is_near(opposite.getValue<_FP16>(i), + static_cast<_FP16>(1.0))) { ++ones; } else { FAIL() << "This should not be happen"; @@ -5768,9 +5735,9 @@ TEST(nntrainer_Tensor, zoneout_mask_03_p) { unsigned int zeros = 0; unsigned int ones = 0; for (unsigned int i = 0; i < t.size(); ++i) { - if (is_near(t.getValue<_Float16>(i), (_Float16)0.0)) { + if (is_near(t.getValue<_FP16>(i), (_FP16)0.0)) { ++zeros; - } else if (is_near(t.getValue<_Float16>(i), (_Float16)1.0)) { + } else if (is_near(t.getValue<_FP16>(i), (_FP16)1.0)) { ++ones; } else { FAIL() << "This should not be happen"; @@ -5793,7 +5760,7 @@ TEST(nntrainer_Tensor, zoneout_mask_04_n) { nntrainer::Tensor opposite = t.zoneout_mask(zoneout_rate); constexpr float epsilon = 1e-3; - auto is_near = [epsilon](_Float16 val1, _Float16 val2) { + auto is_near = [epsilon](_FP16 val1, _FP16 val2) { return val2 - epsilon < val1 && val1 < val2 + epsilon; }; auto percentage = [](unsigned int dividend, unsigned int divisor) { @@ -5804,51 +5771,47 @@ TEST(nntrainer_Tensor, zoneout_mask_04_n) { unsigned int zeros = 0; unsigned int ones = 0; for (unsigned int i = 0; i < opposite.size(); ++i) { - if (is_near(opposite.getValue<_Float16>(i), - static_cast<_Float16>(0.0f))) { + if (is_near(opposite.getValue<_FP16>(i), static_cast<_FP16>(0.0f))) { ++zeros; - } else if (is_near(opposite.getValue<_Float16>(i), - static_cast<_Float16>(1.0f))) { + } else if (is_near(opposite.getValue<_FP16>(i), + static_cast<_FP16>(1.0f))) { ++ones; } else { FAIL() << "This should not be happen"; } } - EXPECT_FALSE( - is_near(static_cast<_Float16>(percentage(ones, opposite.size())), - static_cast<_Float16>(1.0f - zoneout_rate))); + EXPECT_FALSE(is_near(static_cast<_FP16>(percentage(ones, opposite.size())), + static_cast<_FP16>(1.0f - zoneout_rate))); } { unsigned int zeros = 0; unsigned int ones = 0; for (unsigned int i = 0; i < t.size(); ++i) { - if (is_near(t.getValue<_Float16>(i), static_cast<_Float16>(0.0f))) { + if (is_near(t.getValue<_FP16>(i), static_cast<_FP16>(0.0f))) { ++zeros; - } else if (is_near(t.getValue<_Float16>(i), - static_cast<_Float16>(1.0f))) { + } else if (is_near(t.getValue<_FP16>(i), static_cast<_FP16>(1.0f))) { ++ones; } else { FAIL() << "This should not be happen"; } } - EXPECT_FALSE(is_near(static_cast<_Float16>(percentage(ones, t.size())), - static_cast<_Float16>(zoneout_rate))); + EXPECT_FALSE(is_near(static_cast<_FP16>(percentage(ones, t.size())), + static_cast<_FP16>(zoneout_rate))); } } TEST(nntrainer_Tensor, TensorMap_p) { - _Float16 dat[] = {1, 2, 3}; + _FP16 dat[] = {1, 2, 3}; { - nntrainer::Tensor a = - nntrainer::Tensor::Map(dat, 3 * sizeof(_Float16), {3}); - /// check if a.getData<_Float16>() has same address with dat - EXPECT_EQ(dat, a.getData<_Float16>()); + nntrainer::Tensor a = nntrainer::Tensor::Map(dat, 3 * sizeof(_FP16), {3}); + /// check if a.getData<_FP16>() has same address with dat + EXPECT_EQ(dat, a.getData<_FP16>()); { - /// check if b.getData<_Float16>() has same address with data + /// check if b.getData<_FP16>() has same address with data nntrainer::Tensor b = a; - EXPECT_EQ(dat, b.getData<_Float16>()); + EXPECT_EQ(dat, b.getData<_FP16>()); } } /// check if dat is accessible after destruction of all the tensor @@ -5856,29 +5819,29 @@ TEST(nntrainer_Tensor, TensorMap_p) { } TEST(nntrainer_Tensor, TensorWrap_01_n) { - _Float16 dat[] = {1, 2, 3}; + _FP16 dat[] = {1, 2, 3}; EXPECT_THROW(nntrainer::Tensor::Map(dat, 3, nntrainer::TensorDim({})), std::invalid_argument); } TEST(nntrainer_Tensor, TensorWrap_02_n) { - _Float16 dat[] = {1, 2, 3}; + _FP16 dat[] = {1, 2, 3}; EXPECT_THROW(nntrainer::Tensor::Map(dat, 3, {4}), std::invalid_argument); } TEST(nntrainer_Tensor, TensorPaddedValue_p) { nntrainer::Tensor a = ranged(1, 1, 3, 3, nntrainer::Tformat::NCHW, nntrainer::Tdatatype::FP16); - _Float16 default_padded = -1; + _FP16 default_padded = -1; for (int i = 0; i < 5; ++i) { for (int j = 0; j < 5; ++j) { - _Float16 expected = default_padded; + _FP16 expected = default_padded; if (1 <= i && i <= 3 && 1 <= j && j <= 3) { expected = (i - 1) * 3 + (j - 1); } - _Float16 actual = - a.getValuePaddedVirtual<_Float16>(0, 0, i, j, 1, 1, default_padded); + _FP16 actual = + a.getValuePaddedVirtual<_FP16>(0, 0, i, j, 1, 1, default_padded); EXPECT_FLOAT_EQ(actual, expected); } }