30{
31
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
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
55 ::caffe::NetParameter out;
56 {
57 net.ToProto(&out);
58 }
59
60
61 google::protobuf::io::OstreamOutputStream os{&std::cout};
62 google::protobuf::TextFormat::Print(out, &os);
63
64 return 0;
65}