Skip to content

RuntimeError: torch.cat(): expected a non-empty list of Tensors #98

Description

@yizhake

Hi,

I use alpha-beta-crown to verify local robustness of a small fully connected neural network.
For many queries, ab-crown finishes and returns an answer. In some cases, I get an error:
RuntimeError: torch.cat(): expected a non-empty list of Tensors

Added are a property (vnnlib format) and a network (onnx format) for example.

Here is the error traceback:

...
BaB round 43
batch: 1
Start filtering...
Traceback (most recent call last):
  File "<PROJECT_DIR>/global_minimal_explanation_binary_abductive.py", line 629, in <module>
    explanation, part1_time, part2_time = global_minimal_explanation_binary_abductive(
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PROJECT_DIR>/global_minimal_explanation_binary_abductive.py", line 399, in global_minimal_explanation_binary_abductive
    result, cex = is_max_bigger(
                  ^^^^^^^^^^^^^^
  File "<PROJECT_DIR>/global_minimal_explanation_binary_abductive.py", line 267, in is_max_bigger
    return is_satisfiable_comparison(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<PROJECT_DIR>/global_minimal_explanation_binary_abductive.py", line 244, in is_satisfiable_comparison
    result, cex = verify(
                  ^^^^^^^
  File "<PROJECT_DIR>/global_minimal_explanation_binary_abductive.py", line 139, in verify
    res, cex = solve_with_abcrown(
               ^^^^^^^^^^^^^^^^^^^
  File "<PROJECT_DIR>/dnnv_tools/abcrown_utils.py", line 137, in solve_with_abcrown
    abcrown.main()
  File "complete_verifier/abcrown.py", line 797, in main
    verified_status = self.complete_verifier(
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "complete_verifier/abcrown.py", line 501, in complete_verifier
    l, nodes, ret = self.bab(
                    ^^^^^^^^^
  File "complete_verifier/abcrown.py", line 308, in bab
    result = general_bab(
             ^^^^^^^^^^^^
  File "complete_verifier/bab.py", line 462, in general_bab
    global_lb = act_split_round(
                ^^^^^^^^^^^^^^^^
  File "complete_verifier/bab.py", line 189, in act_split_round
    split_domain(net, domains, d, batch, impl_params=impl_params,
  File "complete_verifier/bab.py", line 74, in split_domain
    branching_heuristic.get_branching_decisions(
  File "complete_verifier/heuristics/nonlinear/bbps.py", line 139, in get_branching_decisions
    layers, indices, points = self._filter(
                              ^^^^^^^^^^^^^
  File "complete_verifier/heuristics/nonlinear/bbps.py", line 214, in _filter
    ret_lbs = self._compute_actual_bounds(domains, decisions)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "complete_verifier/heuristics/nonlinear/bbps.py", line 165, in _compute_actual_bounds
    self.net.build_history_and_set_bounds(
  File "complete_verifier/beta_CROWN_solver.py", line 814, in build_history_and_set_bounds
    domain_updater.set_branched_bounds(d, split, mode)
  File "complete_verifier/domain_updater.py", line 142, in set_branched_bounds
    new_alphas[k] = {kk: torch.cat([vv] * self.num_copy, dim=2)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "complete_verifier/domain_updater.py", line 142, in <dictcomp>
    new_alphas[k] = {kk: torch.cat([vv] * self.num_copy, dim=2)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: torch.cat(): expected a non-empty list of Tensors

More details:

self.num_copy = 0

d = {'lower_bounds': {'/input': tensor([], size=(0, 10)), '/12': tensor([], size=(0, 1))}, 'upper_bounds': {'/input': tensor([], size=(0, 10)), '/12': tensor([], size=(0, 1))}, 'alphas': defaultdict(<class 'dict'>, {'/10': {'/12': tensor([[[[0.01190186, 1.00000000, 0.01625061, 1.00000000, 1.00000000,
           1.00000000, 0.97509766, 1.00000000, 1.00000000, 0.01103973]]],
        [[[1.00000000, 1.00000000, 1.00000000, 1.00000000, 1.00000000,
           1.00000000, 0.00000000, 1.00000000, 1.00000000, 1.00000000]]]])}}), 'cs': tensor([[[-1.]]]), 'thresholds': tensor([[1.56789993e-05]]), 'history': []}, 

split = {'decision': [], 'points': tensor([])}

What does it mean, and is there any simple solution to fix it?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    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