From 1c7bbb9cab70df42ea1b320bc383188ff76f77f9 Mon Sep 17 00:00:00 2001 From: Hyukjin Jeong Date: Mon, 28 Oct 2024 11:18:30 +0900 Subject: [PATCH] [record-minmax] Introduce DataSetIterator (#14258) This introduces a base class for iterator. ONE-DCO-1.0-Signed-off-by: Hyukjin Jeong --- compiler/record-minmax/include/DataBuffer.h | 37 ++++++++++++++++ .../record-minmax/include/DataSetIterator.h | 43 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 compiler/record-minmax/include/DataBuffer.h create mode 100644 compiler/record-minmax/include/DataSetIterator.h diff --git a/compiler/record-minmax/include/DataBuffer.h b/compiler/record-minmax/include/DataBuffer.h new file mode 100644 index 00000000000..1cd51a9e0ae --- /dev/null +++ b/compiler/record-minmax/include/DataBuffer.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024 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 __RECORD_MINMAX_DATA_BUFFER_H__ +#define __RECORD_MINMAX_DATA_BUFFER_H__ + +#include +#include + +#include + +namespace record_minmax +{ + +struct DataBuffer +{ + loco::DataType dtype = loco::DataType::Unknown; + std::vector shape; + std::vector data; +}; + +} // namespace record_minmax + +#endif // __RECORD_MINMAX_DATA_BUFFER_H__ diff --git a/compiler/record-minmax/include/DataSetIterator.h b/compiler/record-minmax/include/DataSetIterator.h new file mode 100644 index 00000000000..4b55a65418f --- /dev/null +++ b/compiler/record-minmax/include/DataSetIterator.h @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2024 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 __RECORD_MINMAX_DATASET_ITERATOR_H__ +#define __RECORD_MINMAX_DATASET_ITERATOR_H__ + +#include "DataBuffer.h" + +#include + +namespace record_minmax +{ + +// Base class for dataset iterator +class DataSetIterator +{ +public: + virtual bool hasNext() const = 0; + + virtual std::vector next() = 0; + + // Revisit this interface later + virtual bool check_type_shape() const = 0; + + virtual ~DataSetIterator() = default; +}; + +} // namespace record_minmax + +#endif // __RECORD_MINMAX_DATASET_ITERATOR_H__