Skip to content

Commit

Permalink
[circle-mlir/import] Introduce CircleImport
Browse files Browse the repository at this point in the history
This will introduce CircleImport to import circle mode files.
Code itself is from Tensorflow flatbuffer_import.cc with little
modification and removed that are not necessary at this moment.

ONE-DCO-1.0-Signed-off-by: SaeHie Park <[email protected]>
  • Loading branch information
seanshpark committed Feb 25, 2025
1 parent f008c28 commit 63e23b4
Show file tree
Hide file tree
Showing 3 changed files with 1,128 additions and 0 deletions.
1 change: 1 addition & 0 deletions circle-mlir/circle-mlir/lib/import/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
set(SRC
src/CircleImport.cpp
src/CircleOperator.cpp
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
* Copyright 2019 The TensorFlow Authors. 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.
*/

// from tensorflow/compiler/mlir/lite/flatbuffer_import.h

#ifndef __CIRCLE_MLIR_IMPORT_CIRCLE_IMPORT_H__
#define __CIRCLE_MLIR_IMPORT_CIRCLE_IMPORT_H__

#include <string>
#include <vector>

#include <absl/strings/string_view.h>
#include <mlir/Dialect/Func/IR/FuncOps.h>
#include <mlir/IR/BuiltinOps.h>
#include <mlir/IR/Location.h>
#include <mlir/IR/MLIRContext.h>

namespace mlir
{
namespace Circle
{

mlir::OwningOpRef<mlir::ModuleOp>
FlatBufferToMlir(absl::string_view buffer, mlir::MLIRContext *context, mlir::Location base_loc,
bool use_external_constant = false,
const std::vector<std::string> &ordered_input_arrays = {},
const std::vector<std::string> &ordered_output_arrays = {},
bool experimental_prune_unreachable_nodes_unconditionally = false);

} // namespace Circle
} // namespace mlir

#endif // __CIRCLE_MLIR_IMPORT_CIRCLE_IMPORT_H__
Loading

0 comments on commit 63e23b4

Please sign in to comment.