Skip to content

Instantly share code, notes, and snippets.

@rdzhabarov
Created October 10, 2018 01:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdzhabarov/1e9e339844276622aa0acaf247e213ba to your computer and use it in GitHub Desktop.
Save rdzhabarov/1e9e339844276622aa0acaf247e213ba to your computer and use it in GitHub Desktop.
Failure
collecting 0 items WARNING:root:This caffe2 python run does not have GPU support. Will run in CPU only mode.
collected 3 items
caffe2/python/onnx/test_onnxifi.py WARNING: Logging before InitGoogleLogging() is written to STDERR
W1009 18:19:02.313705 2901128064 init.h:99] Caffe2 GlobalInit should be run before any other API calls.
..Batch size: 1, repeat inference 1 times
W1009 18:20:05.296325 2901128064 init.h:99] Caffe2 GlobalInit should be run before any other API calls.
I1009 18:20:18.989856 2901128064 onnxifi_transformer.cc:312] Adding input hint: real_data_0
I1009 18:20:18.995316 2901128064 onnxifi_transformer.cc:347] Cannot export c2 op Copy to onnx as there is no corresponding ONNX schema.
I1009 18:20:18.999682 2901128064 onnxifi_transformer.cc:363] Don't support onnx for FC c2 op (515)
I1009 18:20:18.999734 2901128064 onnxifi_transformer.cc:363] Don't support onnx for FC c2 op (515)
I1009 18:20:18.999780 2901128064 onnxifi_transformer.cc:347] Cannot export c2 op Copy to onnx as there is no corresponding ONNX schema.
I1009 18:20:18.999789 2901128064 onnxifi_transformer.cc:347] Cannot export c2 op Copy to onnx as there is no corresponding ONNX schema.
C2 runtime: 0.473953008652s
W1009 18:20:39.661360 2901128064 workspace.cc:170] Blob gpu_0/pred_w_0 not in the workspace.
WARNING:caffe2.python.workspace:Original python traceback for operator `2` in network `resnet50_opt` in exception above (most recent call last):
F
==================================================================================== FAILURES ====================================================================================
____________________________________________________________________ OnnxifiTransformTest.test_resnet50_core _____________________________________________________________________
self = <caffe2.python.onnx.test_onnxifi.OnnxifiTransformTest testMethod=test_resnet50_core>
def test_resnet50_core(self):
N = 1
repeat = 1
print("Batch size: {}, repeat inference {} times".format(N, repeat))
init_net, pred_net, _ = self._get_c2_model('resnet50')
self._add_head_tail(pred_net, 'real_data', 'real_softmax')
input_blob_dims = (N, 3, 224, 224)
input_name = "real_data"
device_option = core.DeviceOption(caffe2_pb2.CPU, 0)
init_net.device_option.CopyFrom(device_option)
pred_net.device_option.CopyFrom(device_option)
for op in pred_net.op:
op.device_option.CopyFrom(device_option)
net_outputs = pred_net.external_output
Y_c2 = None
data = np.random.randn(*input_blob_dims).astype(np.float32)
c2_time = 1
workspace.SwitchWorkspace("onnxifi_test", True)
with core.DeviceScope(device_option):
workspace.FeedBlob(input_name, data)
workspace.RunNetOnce(init_net)
workspace.CreateNet(pred_net)
start = time.time()
for _ in range(repeat):
workspace.RunNet(pred_net.name)
end = time.time()
c2_time = end - start
output_values = [workspace.FetchBlob(name) for name in net_outputs]
Y_c2 = namedtupledict('Outputs', net_outputs)(*output_values)
workspace.ResetWorkspace()
# Fill the workspace with the weights
with core.DeviceScope(device_option):
workspace.RunNetOnce(init_net)
# Cut the graph
start = time.time()
pred_net_cut = onnxifi_caffe2_net(pred_net,
{input_name: input_blob_dims})
del init_net, pred_net
#_print_net(pred_net_cut)
Y_trt = None
input_name = pred_net_cut.external_input[0]
print("C2 runtime: {}s".format(c2_time))
with core.DeviceScope(device_option):
workspace.FeedBlob(input_name, data)
> workspace.CreateNet(pred_net_cut)
caffe2/python/onnx/test_onnxifi.py:224:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
caffe2/python/workspace.py:154: in CreateNet
StringifyProto(net), overwrite,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
func = <built-in method create_net of PyCapsule object at 0x10e435d20>
op_id_fetcher = <bound method Workspace._last_failed_op_net_position of <caffe2.python.caffe2_pybind11_state.Workspace object at 0x110cd1f48>>, net_name = 'resnet50_opt'
args = ('\n\x0cresnet50_opt\x12\'\n\x0breal_data_0\x12\x0cgpu_0/data_0"\x04Copy2\x04\x08\x00\x10\x00\x12\x87\x99\x03\n\x0cgpu...04\x08\x00\x10\x00*\x04\x08\x00\x10\x00:\x0breal_data_0:\x0egpu_0/pred_w_0:\x0egpu_0/pred_b_0B\x0creal_softmax', False)
kwargs = {}, op_id = 2, net_tracebacks = None
def CallWithExceptionIntercept(func, op_id_fetcher, net_name, *args, **kwargs):
try:
> return func(*args, **kwargs)
E RuntimeError: [enforce fail at operator.cc:46] blob != nullptr. op FC: Encountered a non-existing input blob: gpu_0/pred_w_0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment