+++ /dev/null
-/*
- * Copyright (c) 2019 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.
- */
-
-#ifndef __COMPILER_ARGS_H
-#define __COMPILER_ARGS_H
-
-#include <nncc/core/ADT/tensor/Shape.h>
-
-#include <map>
-#include <stdexcept>
-
-namespace moco
-{
-namespace tf
-{
-
-/**
- * @brief Class that stores parsed arguments passed from command line interface.
- * Command line parser should fill member vars of the instance of this class.
- */
-class CompilerArgs final
-{
-public:
- /**
- * @brief Adds graph input name and its shape provided from user
- */
- void addInput(const std::string &input_name, const nncc::core::ADT::tensor::Shape &shape)
- {
- if (_inputs.find(input_name) != _inputs.end())
- throw std::runtime_error{"Duplicated input name: " + input_name};
-
- _inputs[input_name] = shape;
- }
-
- const nncc::core::ADT::tensor::Shape *getInputShape(const std::string &input_name)
- {
- auto res = _inputs.find(input_name);
- if (res == _inputs.end())
- return nullptr;
- else
- return &res->second;
- }
-
-public:
- /**
- * @brief function to get a singleton instance
- */
- static CompilerArgs *get()
- {
- static CompilerArgs me;
- return &me;
- }
-
- /**
- * @brief Clears all data. Only for testing purpose.
- */
- void clear() { _inputs.clear(); }
-
-private:
- CompilerArgs() = default;
-
-private:
- // For command line argument input shapes and input names
- std::map<std::string, nncc::core::ADT::tensor::Shape> _inputs;
-
- // add more compiler arguments
-};
-
-} // namespace tf
-} // namespace moco
-
-#endif // __COMPILER_ARGS_H
+++ /dev/null
-/*
- * Copyright (c) 2019 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 "CompilerArgs.h"
-
-#include <gtest/gtest.h>
-
-#include <string>
-
-TEST(CompilerArgs, inputShape_empty)
-{
- auto args = moco::tf::CompilerArgs::get();
-
- std::string any_name = "any";
- ASSERT_TRUE(args->getInputShape(any_name) == nullptr);
-}