MCPcopy Create free account
hub / github.com/pytorch/pytorch / ConvertProtoToBinary

Function ConvertProtoToBinary

caffe2/python/utils.py:238–243  ·  view source on GitHub ↗

Convert a text file of the given protobuf class to binary.

(proto_class, filename, out_filename)

Source from the content-addressed store, hash-verified

236
237
238def ConvertProtoToBinary(proto_class, filename, out_filename):
239 """Convert a text file of the given protobuf class to binary."""
240 with open(filename) as f:
241 proto = TryReadProtoWithClass(proto_class, f.read())
242 with open(out_filename, 'w') as fid:
243 fid.write(proto.SerializeToString())
244
245
246def GetGPUMemoryUsageStats():

Callers

nothing calls this directly

Calls 3

TryReadProtoWithClassFunction · 0.85
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…