ShotaArima / demo-lowprofool

0 stars 0 forks source link

bug#4 Key Error #5

Closed ShotaArima closed 1 month ago

ShotaArima commented 1 month ago

変更内容

今後の変更について

現在のエラー

---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
/tmp/ipykernel_2374/4182338255.py in <module>
     54 
     55 # Generate adversarial examples
---> 56 df_adv_lpf = gen_adv(config, 'LowProFool')
     57 df_adv_df = gen_adv(config, 'Deepfool')
     58 config['AdvData'] = {'LowProFool' : df_adv_lpf, 'Deepfool' : df_adv_df}

/tmp/ipykernel_2374/1714799004.py in gen_adv(config, method)
     17 
     18         if method == 'LowProFool':
---> 19             orig_pred, adv_pred, x_adv, loop_i = lowProFool(x_tensor, model, weights, bounds, maxiters, alpha, lambda_)
     20         elif method == 'Deepfool':
     21             orig_pred, adv_pred, x_adv, loop_i = deepfool(x_tensor, model, maxiters, alpha, bounds, weights=[])

/src/Adverse.py in lowProFool(x, model, weights, bounds, maxiters, alpha, lambda_)
    111         print("Shape of max_bounds:", max_bounds.shape)
    112         # Clip to stay in legitimate bounds
--> 113         xprime = clip(xprime, min_bounds, max_bounds)
    114 
    115         # Classify adversarial example

/src/Adverse.py in clip(current, low_bound, up_bound)
     10 # Clipping function
...
---> 12     assert(len(current) == len(up_bound) and len(low_bound) == len(up_bound)) # 不一致を許容することも視野に入れる
     13     low_bound = torch.FloatTensor(low_bound)
     14     up_bound = torch.FloatTensor(up_bound)

AssertionError: 
Output is truncated. View as a [scrollable element](command:cellOutput.enableScrolling?734ab76a-20d1-48c5-827c-72ea7c9b919d) or open in a [text editor](command:workbench.action.openLargeOutput?734ab76a-20d1-48c5-827c-72ea7c9b919d). Adjust cell output [settings](command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D)...