Caffe2在推理阶段可以使用memonger的optimize_inference_net函数做内存优化吗?

我仿照Caffe2提供的resnet_test.py中的 test_resnet_forward_only_fast_simplenet()函数写了个C++版本的optimize_inference_net函数调用,结果报错如下,说是共享之后的Blob名称和网络模型中的名称不匹配了。terminate called after throwing an instance of 'caffe2::EnforceNotMet'
  what():  [enforce fail at net.cc:77] . op Conv: Source for input __m0_shared is unknown for net LeNet, operator input: "__m0_shared" input: "__m1_shared" input: "__m2_shared" output: "__m3_shared" type: "Conv" arg { name: "stride" i: 1 } arg { name: "pad" i: 0 } arg { name: "kernel" i: 5 } 
 
直接调用Caffe2自带的resnet_test.py也是报的这个错误,所有,请问是我使用的不对,还是这个函数不用?
Traceback (most recent call last):
  File "/usr/local/caffe2/python/models/resnet_test.py", line 207, in test_resnet_forward_only_fast_simplenet
    workspace.RunNetOnce(optim_proto)
  File "/usr/local/caffe2/python/workspace.py", line 210, in RunNetOnce
    StringifyProto(net),
  File "/usr/local/caffe2/python/workspace.py", line 193, in CallWithExceptionIntercept
    return func(*args, **kwargs)
RuntimeError: [enforce fail at net.cc:77] . op Conv: Source for input __m0_shared is unknown for net test_1, operator input: "__m0_shared" input: "__m1_shared" input: "__m2_shared" output: "__m3_shared" name: "" type: "Conv" arg { name: "kernel" i: 7 } arg { name: "exhaustive_search" i: 1 } arg { name: "pad" i: 3 } arg { name: "order" s: "NCHW" } arg { name: "stride" i: 2 } engine: "CUDNN" 
已邀请:

要回复问题请先登录注册