diff options
Diffstat (limited to 'compiler/angkor/src/ADT/feature/HWCLayout.test.cpp')
-rw-r--r-- | compiler/angkor/src/ADT/feature/HWCLayout.test.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/compiler/angkor/src/ADT/feature/HWCLayout.test.cpp b/compiler/angkor/src/ADT/feature/HWCLayout.test.cpp new file mode 100644 index 000000000..d1f359753 --- /dev/null +++ b/compiler/angkor/src/ADT/feature/HWCLayout.test.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nncc/core/ADT/feature/HWCLayout.h" + +#include <gtest/gtest.h> + +using namespace nncc::core::ADT::feature; + +TEST(ADT_FEATURE_HWC_LAYOUT, C_increase) +{ + const uint32_t C = 4; + const uint32_t H = 3; + const uint32_t W = 6; + + const Shape shape{C, H, W}; + const HWCLayout l; + + ASSERT_EQ(l.offset(shape, 1, 1, 1) + 1, l.offset(shape, 2, 1, 1)); +} + +TEST(ADT_FEATURE_HWC_LAYOUT, W_increase) +{ + const uint32_t C = 4; + const uint32_t H = 3; + const uint32_t W = 6; + + const Shape shape{C, H, W}; + const HWCLayout l; + + ASSERT_EQ(l.offset(shape, 1, 2, 1) + C, l.offset(shape, 1, 2, 2)); +} + +TEST(ADT_FEATURE_HWC_LAYOUT, H_increase) +{ + const uint32_t C = 4; + const uint32_t H = 3; + const uint32_t W = 6; + + const Shape shape{C, H, W}; + const HWCLayout l; + + ASSERT_EQ(l.offset(shape, 1, 1, 1) + W * C, l.offset(shape, 1, 2, 1)); +} |