27 #ifndef MXNET_CPP_OP_UTIL_H_ 28 #define MXNET_CPP_OP_UTIL_H_ 32 #if defined(MXNET_USE_CAFFE) && MXNET_USE_CAFFE != 0 33 #include <caffe/proto/caffe.pb.h> 34 #include <google/protobuf/text_format.h> 40 #if defined(MXNET_USE_CAFFE) && MXNET_USE_CAFFE != 0 42 inline ::caffe::LayerParameter textToCaffeLayerParameter(
const std::string& text) {
43 caffe::NetParameter np;
44 const bool success = google::protobuf::TextFormat::ParseFromString(text, &np);
45 CHECK_EQ(success,
true) <<
"Invalid protpbuf layer string: " << text;
46 return ::caffe::LayerParameter(np.layer(0));
49 template<
typename StreamType>
50 inline StreamType&
operator << (StreamType& os, const ::caffe::LayerParameter& op) {
52 caffe::NetParameter np;
54 np.mutable_layer()->AddAllocated(const_cast<::caffe::LayerParameter *>(&op));
55 google::protobuf::TextFormat::PrintToString(np, &s);
56 np.mutable_layer()->ReleaseLast();
65 #endif // MXNET_CPP_OP_UTIL_H_ namespace of mxnet
Definition: base.h:127
std::ostream & operator<<(std::ostream &out, const NDArray &ndarray)