pytorch
d8fc7923 - [easy] add an `inplace` argument to MutableNetProto.to_net() and core.Net() constructor (#63068)

Commit
3 years ago
[easy] add an `inplace` argument to MutableNetProto.to_net() and core.Net() constructor (#63068) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/63068 The caffe2 core.Net constructor can accept a caffe2_pb2.NetDef proto, but it always creates a copy. This is wasteful when we can prove that the proto being passed to it will not be used anywhere else. So we add an "inplace" argument to the `core.Net` constructor that allows clients to give away ownership of the passed proto without copying. We default this argument to `False`, ensuring that behavior does not change unless explicitly requested. Test Plan: Let CI run. Differential Revision: D29976510 fbshipit-source-id: 26e13ca76f3431b8ef0de51f08bbf263491d323e
Author
Committer
Parents
Loading