20 #include "caffe2/core/blob_serialization.h" 21 #include "caffe2/core/db.h" 22 #include "caffe2/core/init.h" 23 #include "caffe2/core/logging.h" 24 #include "caffe2/proto/caffe2_pb.h" 25 #include "caffe2/utils/proto_utils.h" 27 C10_DEFINE_string(f_in,
"",
"The input data file name.");
28 C10_DEFINE_string(f_out,
"",
"The output data file name.");
30 int main(
int argc,
char** argv) {
32 std::ifstream f_in(FLAGS_f_in);
33 std::ofstream f_out(FLAGS_f_out);
35 caffe2::TensorProtos tensor_protos;
36 while (std::getline(f_in, line)) {
37 caffe2::TensorProto* data = tensor_protos.add_protos();
38 data->set_data_type(caffe2::TensorProto::STRING);
40 data->add_string_data(line);
41 data->set_name(
"text");
44 std::string output_str;
45 tensor_protos.SerializeToString(&output_str);
bool GlobalInit(int *pargc, char ***pargv)
Initialize the global environment of caffe2.