ONE - On-device Neural Engine
Loading...
Searching...
No Matches
InitCommand Struct Referencefinal

#include <InitCommand.h>

Collaboration diagram for InitCommand:

Public Member Functions

int run (int argc, const char *const *argv) const override
 
- Public Member Functions inherited from cli::Command
virtual ~Command ()=default
 

Detailed Description

Definition at line 22 of file InitCommand.h.

Member Function Documentation

◆ run()

int InitCommand::run ( int  argc,
const char *const *  argv 
) const
overridevirtual

Implements cli::Command.

Definition at line 29 of file InitCommand.cpp.

30{
31 // Read prototxt from standard input
32 ::caffe::NetParameter in;
33 {
34 google::protobuf::io::IstreamInputStream is{&std::cin};
35 if (!google::protobuf::TextFormat::Parse(&is, &in))
36 {
37 std::cerr << "ERROR: Failed to parse prototxt" << std::endl;
38 return 255;
39 }
40 }
41
42 // Upgrade prototxt if necessary
43 if (::caffe::NetNeedsUpgrade(in))
44 {
45 if (!::caffe::UpgradeNetAsNeeded("<stdin>", &in))
46 {
47 std::cerr << "ERROR: Failed to upgrade prototxt" << std::endl;
48 return 255;
49 }
50 }
51
52 ::caffe::Net<float> net(in);
53
54 // Extract initialized parameters
55 ::caffe::NetParameter out;
56 {
57 net.ToProto(&out);
58 }
59
60 // Write initialized parameters to standard output
61 google::protobuf::io::OstreamOutputStream os{&std::cout};
62 google::protobuf::TextFormat::Print(out, &os);
63
64 return 0;
65}

Referenced by package.infer.session::inference().


The documentation for this struct was generated from the following files: