#include <EncodeCommand.hpp>
|
int | run (int argc, const char *const *argv) const override |
|
Public Member Functions inherited from cli::Command |
virtual | ~Command ()=default |
|
Definition at line 25 of file EncodeCommand.hpp.
◆ run()
int EncodeCommand::run |
( |
int |
argc, |
|
|
const char *const * |
argv |
|
) |
| const |
|
overridevirtual |
Implements cli::Command.
Definition at line 29 of file EncodeCommand.cpp.
30{
31 tensorflow::GraphDef graph_def;
32
33 CmdArguments cmdargs(argc, argv);
34
36
37 google::protobuf::io::IstreamInputStream is{ioconfig->in()};
38
39 if (!google::protobuf::TextFormat::Parse(&is, &graph_def))
40 {
41 std::cerr << "ERROR: Failed to parse prototxt" << std::endl;
42 return 255;
43 }
44
45 google::protobuf::io::OstreamOutputStream os{ioconfig->out()};
46 google::protobuf::io::CodedOutputStream coded_os{&os};
47
48 if (!graph_def.SerializeToCodedStream(&coded_os))
49 {
50 std::cerr << "ERROR: Failed to serialize" << std::endl;
51 return 255;
52 }
53
54 return 0;
55}
std::unique_ptr< IOConfiguration > make_ioconfig(const CmdArguments &cmdargs)
References tfkit::make_ioconfig().
Referenced by package.infer.session::inference().
The documentation for this struct was generated from the following files: