From 6a9f560e69032d1eee5a718c82c0333ff182e37b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=84=B8=ED=9D=AC/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Principal=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Tue, 4 Dec 2018 10:36:51 +0900 Subject: [PATCH] [tfldump] Empty tflite Model dump (#2466) This will introduce empty tflite::Model dump as a place holder Signed-off-by: SaeHie Park --- contrib/tfldump/driver/Driver.cpp | 5 +++- contrib/tfldump/include/tfldump/Dump.h | 32 ++++++++++++++++++++++ contrib/tfldump/src/Dump.cpp | 50 ++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 contrib/tfldump/include/tfldump/Dump.h create mode 100644 contrib/tfldump/src/Dump.cpp diff --git a/contrib/tfldump/driver/Driver.cpp b/contrib/tfldump/driver/Driver.cpp index 2b95520..2ede0fd 100644 --- a/contrib/tfldump/driver/Driver.cpp +++ b/contrib/tfldump/driver/Driver.cpp @@ -15,6 +15,7 @@ */ #include +#include #include @@ -43,7 +44,9 @@ int entry(int argc, char **argv) return 255; } - // TODO dump TFlite model + std::cout << "Dump: " << argv[1] << std::endl << std::endl; + + std::cout << tflmodel << std::endl; return 0; } diff --git a/contrib/tfldump/include/tfldump/Dump.h b/contrib/tfldump/include/tfldump/Dump.h new file mode 100644 index 0000000..979ef58 --- /dev/null +++ b/contrib/tfldump/include/tfldump/Dump.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +#ifndef __TFLDUMP_DUMP_H__ +#define __TFLDUMP_DUMP_H__ + +#include + +#include + +namespace tfldump +{ + +void dump_model(std::ostream &os, const tflite::Model *model); +} + +std::ostream &operator<<(std::ostream &os, const tflite::Model *model); + +#endif // __TFLDUMP_DUMP_H__ diff --git a/contrib/tfldump/src/Dump.cpp b/contrib/tfldump/src/Dump.cpp new file mode 100644 index 0000000..aedac6d --- /dev/null +++ b/contrib/tfldump/src/Dump.cpp @@ -0,0 +1,50 @@ +/* + * 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 + +#include + +namespace tfldump +{ + +void dump_model(std::ostream &os, const tflite::Model *model) +{ + // TODO place reader + + // dump operator_codes + os << "Operator Codes:" << std::endl; + + // dump buffer + os << "Buffers:" << std::endl; + + // dump operands(tensors) + os << "Operands:" << std::endl; + + // dump operators + os << "Operators:" << std::endl; + + // dump network inputs/outputs + os << "Inputs/Outputs:" << std::endl; +} + +} // namespace tfldump + +std::ostream &operator<<(std::ostream &os, const tflite::Model *model) +{ + tfldump::dump_model(os, model); + return os; +} -- 2.7.4