--- /dev/null
+#include "DecodeCommand.h"
+
+#include <caffe.pb.h>
+
+#include <google/protobuf/io/coded_stream.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
+#include <google/protobuf/text_format.h>
+
+#include <iostream>
+
+int DecodeCommand::run(int, char **) const
+{
+ caffe::NetParameter param;
+
+ // Load binary from standard input
+ google::protobuf::io::FileInputStream is{0};
+ google::protobuf::io::CodedInputStream coded_is{&is};
+
+ if (!param.ParseFromCodedStream(&coded_is))
+ {
+ std::cerr << "ERROR: Failed to parse caffemodel" << std::endl;
+ return 255;
+ }
+
+ // Write text into standard input
+ google::protobuf::io::FileOutputStream os{1};
+ google::protobuf::TextFormat::Print(param, &os);
+
+ return 0;
+}
--- /dev/null
+#ifndef __DECODE_COMMAND_H__
+#define __DECODE_COMMAND_H__
+
+#include "Command.h"
+
+struct DecodeCommand final : public Command
+{
+ int run(int argc, char **argv) const override;
+};
+
+#endif // __DECODE_COMMAND_H__
#include "FillCommand.h"
#include "EncodeCommand.h"
+#include "DecodeCommand.h"
#include <nncc/foundation/Memory.h>
commands["fill"] = nncc::foundation::make_unique<FillCommand>();
commands["encode"] = nncc::foundation::make_unique<EncodeCommand>();
+ commands["decode"] = nncc::foundation::make_unique<DecodeCommand>();
return commands.at(argv[1])->run(argc - 2, argv + 2);
}