Skip to content

OnnxBackendNodeModelTest.test_dynamic_slice_cpu is flaky on CircleCI #11362

@ezyang

Description

@ezyang

=================================== FAILURES ===================================
_______________ OnnxBackendNodeModelTest.test_dynamic_slice_cpu ________________

args = (<caffe2.python.onnx.tests.onnx_backend_test.OnnxBackendNodeModelTest testMethod=test_dynamic_slice_cpu>,)
kwargs = {}

    @unittest.skipIf(  # type: ignore
        not self.backend.supports_device(device),
        "Backend doesn't support device {}".format(device))
    @functools.wraps(test_func)
    def device_test_func(*args, **kwargs):  # type: (*Any, **Any) -> Any
        try:
>           return test_func(*args, device=device, **kwargs)

../.local/lib/python2.7/site-packages/onnx/backend/test/runner/__init__.py:245: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../.local/lib/python2.7/site-packages/onnx/backend/test/runner/__init__.py:275: in run
    prepared_model = self.backend.prepare(model, device)
/usr/local/caffe2/lib/python2.7/dist-packages/caffe2/python/onnx/backend.py:716: in prepare
    init_net, predict_net = cls._onnx_model_to_caffe2_net(model, device, opset_version, False)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'caffe2.python.onnx.backend.Caffe2Backend'>
onnx_model = ir_version: 3
producer_name: "backend-test"
graph {
  node {
    input: "x"
  ...    }
        }
      }
    }
  }
}
opset_import {
  domain: ""
  version: 9
}

device = 'CPU', opset_version = 9L, include_initializers = False

    @classmethod
    def _onnx_model_to_caffe2_net(cls, onnx_model, device, opset_version, include_initializers):
        device_option = get_device_option(Device(device))
    
        onnx_model = onnx.utils.polish_model(onnx_model)
        init_model = cls.optimize_onnx(onnx_model, init=True)
        pred_model = cls.optimize_onnx(onnx_model, predict=True)
    
        init_net = caffe2_pb2.NetDef()
        pred_net = caffe2_pb2.NetDef()
    
        init_net.name = onnx_model.graph.name + '_init'
        pred_net.name = onnx_model.graph.name + '_predict'
    
        if include_initializers:
            init_net.op.extend(cls._create_tensor_filling_op(tp) for tp in onnx_model.graph.initializer)
    
        cls._dummy_name.reset(cls._all_names_in_graph(init_model.graph) | cls._all_names_in_graph(pred_model.graph))
    
        success = True
        for net, model in ( (init_net, init_model), (pred_net, pred_model) ):
            net.device_option.CopyFrom(device_option)
            for node in model.graph.node:
                try:
                    c2ops = cls._onnx_node_to_caffe2_op(
                        init_model, pred_model, node, opset_version)
                except Exception as e:
                    success = False
                    print('ONNX FATAL:', e)
                    continue
                init_net.op.extend(c2ops.init_ops)
                net.op.extend(c2ops.ops)
                net.external_input.extend(c2ops.interface_blobs)
            net.external_output.extend(
                value_info.name for value_info in model.graph.output)
            net.external_input.extend(
                value_info.name for value_info in model.graph.input)
    
        if not success:
>           raise RuntimeError('ONNX conversion failed')
E           RuntimeError: ONNX conversion failed

Sample log https://circleci.com/gh/pytorch/pytorch/13179?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions