MCPcopy Index your code

hub / github.com/imrahulr/hat / functions

Functions206 in github.com/imrahulr/hat

↓ 62 callersMethodlog
(self, message)
core/utils/logger.py:21
↓ 27 callersMethodeval
Evaluate performance of the model.
core/utils/train.py:224
↓ 26 callersFunctionaccuracy
Computes multi-class accuracy. Arguments: true (torch.Tensor): true labels. preds (torch.Tensor): predicted labels. Retur
core/metrics.py:3
↓ 14 callersFunctionseed
Seed for PyTorch reproducibility. Arguments: seed (int): Random seed value.
core/utils/utils.py:87
↓ 13 callersFunctionctx_noparamgrad_and_eval
(module)
core/utils/context.py:33
↓ 11 callersMethodperturb
(self, x, y)
core/attacks/apgd.py:31
↓ 10 callersFunctioncreate_attack
Initialize adversary. Arguments: model (nn.Module): forward pass function. criterion (nn.Module): loss function. atta
core/attacks/__init__.py:25
↓ 10 callersMethodstep
(self)
core/utils/rst.py:20
↓ 9 callersFunctionclamp
Clamp a tensor by its minimun and maximun values.
core/attacks/utils.py:35
↓ 7 callersFunctionbatch_multiply
Multpliy a batch of tensors with a float or vector.
core/attacks/utils.py:89
↓ 7 callersMethodsave_model
Save model weights.
core/utils/train.py:301
↓ 7 callersMethodtrain
Run one epoch of training.
core/utils/train.py:113
↓ 6 callersFunctiontrack_bn_stats
If track_stats=False, do not update BN running mean and variance and vice versa.
core/utils/utils.py:33
↓ 6 callersMethodtrain
Run one epoch of training.
gowal21uncovering/utils/watrain.py:75
↓ 5 callersFunctioncreate_model
Returns suitable model from its name. Arguments: name (str): name of resnet architecture. normalize (bool): normalize input.
core/models/__init__.py:21
↓ 5 callersFunctionget_data_info
Returns dataset information. Arguments: data_dir (str): path to data directory.
core/data/__init__.py:29
↓ 4 callersMethod_make_layer
(self, block, planes, num_blocks, stride)
core/models/ti_preact_resnet.py:88
↓ 4 callersMethod_make_layer
(self, block, planes, num_blocks, stride)
core/models/in_preact_resnet.py:92
↓ 4 callersMethod_make_layer
(self, block, planes, num_blocks, stride)
core/models/preact_resnet.py:87
↓ 4 callersMethod_make_layer
(self, block, planes, num_blocks, stride)
core/models/resnet.py:120
↓ 4 callersMethod_make_layer
(self, in_planes, out_planes, num_blocks, stride, activation_fn)
core/models/preact_resnetwithswish.py:116
↓ 4 callersMethod_verify_and_process_inputs
(self, x, y)
core/attacks/base.py:53
↓ 4 callersFunctionload_data
Returns train, test datasets and dataloaders. Arguments: data_dir (str): path to data directory. batch_size (int): batch size
core/data/__init__.py:52
↓ 4 callersFunctionreplicate_input
Clone the input tensor x.
core/attacks/utils.py:13
↓ 4 callersMethodsave_and_eval_adversarial
Evaluate adversarial accuracy and save perturbations.
core/utils/train.py:244
↓ 3 callersMethod__init__
(self, block, num_blocks, num_classes=10)
core/models/resnet.py:108
↓ 3 callersFunctionformat_time
Format time for displaying. Arguments: elapsed: time interval in seconds.
core/utils/utils.py:77
↓ 3 callersMethodinit_optimizer
Initialize optimizer and scheduler.
core/utils/train.py:80
↓ 3 callersFunctionis_float_or_torch_tensor
Return whether input x is a float or a torch.Tensor.
core/attacks/utils.py:147
↓ 3 callersMethodload_model
Load model weights.
core/utils/train.py:308
↓ 3 callersFunctionnormalize_by_pnorm
Normalize gradients for gradient (not gradient sign) attacks. Arguments: x (torch.Tensor): tensor containing the gradients on the inp
core/attacks/utils.py:154
↓ 3 callersFunctionnp_load
Read data from npy files. Arguments: foldername (str): path to the folder.
core/utils/utils.py:122
↓ 3 callersFunctionparser_eval
Parse input arguments (eval-adv.py, eval-corr.py, eval-aa.py).
core/utils/parser.py:71
↓ 2 callersMethod__init__
(self, predict, loss_fn='ce', n_restarts=2, eps=0.3, nb_iter=40, ord=np.inf, seed=1)
core/attacks/apgd.py:22
↓ 2 callersMethod__init__
( self, predict, loss_fn=None, eps=0.3, nb_iter=40, eps_iter=0.01, rand_init=True, clip_min=0., cl
core/attacks/pgd.py:91
↓ 2 callersMethod__init__
( self, predict, overshoot=0.02, nb_iter=50, search_iter=50, clip_min=0., clip_max=1., ord=np.inf)
core/attacks/deepfool.py:123
↓ 2 callersMethod__init__
(self, in_planes, planes, stride=1)
core/models/ti_preact_resnet.py:16
↓ 2 callersMethod__init__
(self, in_planes, out_planes, stride, activation_fn=nn.ReLU)
core/models/wideresnetwithswish.py:34
↓ 2 callersMethod__init__
(self, in_planes, planes, stride=1)
core/models/in_preact_resnet.py:16
↓ 2 callersMethod__init__
(self, in_planes, planes, stride=1)
core/models/preact_resnet.py:16
↓ 2 callersMethod__init__
(self, in_planes, out_planes, stride, dropRate=0.0)
core/models/wideresnet.py:19
↓ 2 callersFunction_get_norm_batch
Returns the Lp norm of batch x.
core/attacks/utils.py:118
↓ 2 callersMethod_pad
(self, x)
core/models/preact_resnetwithswish.py:51
↓ 2 callersFunction_setup
(data_dir, name='train')
core/setup.py:17
↓ 2 callersMethodadversarial_loss
Adversarial training (Madry et al, 2017).
core/utils/train.py:163
↓ 2 callersFunctionclamp_by_pnorm
Clamp tensor by its norm.
core/attacks/utils.py:133
↓ 2 callersMethodeval
Evaluate performance of the model.
gowal21uncovering/utils/watrain.py:155
↓ 2 callersFunctioneval_multiple_restarts
Evaluate adversarial accuracy with multiple restarts.
eval-adv.py:76
↓ 2 callersFunctionextract_zip
(in_file, out_dir)
core/setup.py:7
↓ 2 callersMethodinit_scheduler
Initialize scheduler.
core/utils/train.py:91
↓ 2 callersMethodmart_loss
MART training.
core/utils/train.py:214
↓ 2 callersFunctionnp_save
Write data as npy files. Arguments: data (Dict): data to be written. foldername (str): path to the folder.
core/utils/utils.py:141
↓ 2 callersFunctionparser_train
Parse input arguments (train.py).
core/utils/parser.py:11
↓ 2 callersFunctionset_bn_momentum
Set the value of momentum for all BN layers.
core/utils/utils.py:41
↓ 2 callersMethodstandard_loss
Standard training.
core/utils/train.py:150
↓ 1 callersMethod__init__
(self, base_dataset='cifar10', take_amount=None, take_amount_seed=13, aux_data_filename=None,
core/data/semisup.py:32
↓ 1 callersMethod__init__
(self, predict, loss_fn=None, eps=0.3, clip_min=0., clip_max=1., targeted=False)
core/attacks/fgsm.py:74
↓ 1 callersMethod__init__
(self, in_planes, out_planes, stride, activation_fn=nn.ReLU)
core/models/preact_resnetwithswish.py:33
↓ 1 callersFunction_batch_clamp_tensor_by_vector
Equivalent to the following. for ii in range(len(vector)): batch_tensor[ii] = clamp( batch_tensor[ii], -vector[ii], vector[ii]
core/attacks/utils.py:78
↓ 1 callersFunction_batch_multiply_tensor_by_vector
Equivalent to the following. for ii in range(len(vector)): batch_tensor.data[ii] *= vector[ii] return batch_tensor
core/attacks/utils.py:68
↓ 1 callersMethod_get_predicted_label
Compute predicted labels given x. Used to prevent label leaking during adversarial training. Arguments: x (torch.Tensor):
core/attacks/base.py:40
↓ 1 callersMethod_make_layer
(self, block, in_planes, out_planes, nb_layers, stride, dropRate)
core/models/wideresnet.py:61
↓ 1 callersMethod_reset
(self)
core/utils/rst.py:16
↓ 1 callersFunctionat_hat_loss
AT + Helper-based adversarial training.
core/utils/hat.py:85
↓ 1 callersFunctionat_hat_loss
AT + Helper-based adversarial training.
gowal21uncovering/utils/hat.py:96
↓ 1 callersFunctionbatch_clamp
Clamp a batch of tensors.
core/attacks/utils.py:103
↓ 1 callersFunctioncopy
(in_file, out_dir)
core/setup.py:12
↓ 1 callersFunctionema_update
Exponential model weight averaging update.
gowal21uncovering/utils/watrain.py:195
↓ 1 callersFunctionget_module_training_state
(module)
core/utils/context.py:38
↓ 1 callersFunctionget_orthogonal_vector
Returns a random unit vector orthogonal to given unit vector r.
core/utils/exp.py:13
↓ 1 callersFunctionget_param_grad_state
(module)
core/utils/context.py:52
↓ 1 callersFunctionget_semisup_dataloaders
Return dataloaders with custom sampling of pseudo-labeled data.
core/data/semisup.py:8
↓ 1 callersFunctionhat_loss
TRADES + Helper-based adversarial training.
core/utils/hat.py:14
↓ 1 callersFunctionhat_loss
TRADES + Helper-based adversarial training.
gowal21uncovering/utils/hat.py:15
↓ 1 callersMethodhat_loss
Helper-based adversarial training.
core/utils/train.py:189
↓ 1 callersMethodhat_loss
Helper-based adversarial training.
gowal21uncovering/utils/watrain.py:126
↓ 1 callersFunctionin_preact_resnet
Returns suitable PreAct Resnet model from its name (only for ImageNet-100 dataset). Arguments: name (str): name of resnet architectur
core/models/in_preact_resnet.py:117
↓ 1 callersMethodinit_attack
Initialize adversary.
core/utils/train.py:66
↓ 1 callersFunctionline_search
Perform line search to find margin.
core/utils/exp.py:26
↓ 1 callersMethodload_base_dataset
(self, **kwargs)
core/data/semisup.py:95
↓ 1 callersFunctionmart_loss
MART training (Wang et al, 2020).
core/utils/mart.py:9
↓ 1 callersMethodperturb
Virtual method for generating the adversarial examples. Arguments: x (torch.Tensor): the model's input tensor.
core/attacks/base.py:23
↓ 1 callersFunctionperturb_deepfool
Compute DeepFool perturbations (Moosavi-Dezfooli et al, 2016). Arguments: xvar (torch.Tensor): input images. yvar (torch.Tens
core/attacks/deepfool.py:17
↓ 1 callersFunctionperturb_iterative
Iteratively maximize the loss over the input. It is a shared method for iterative attacks. Arguments: xvar (torch.Tensor): input data
core/attacks/pgd.py:17
↓ 1 callersFunctionpreact_resnet
Returns suitable Resnet model from its name. Arguments: name (str): name of resnet architecture. num_classes (int): number of
core/models/preact_resnet.py:108
↓ 1 callersFunctionpreact_resnetwithswish
Returns suitable PreActResNet model with Swish activation function from its name. Arguments: name (str): name of resnet architecture.
core/models/preact_resnetwithswish.py:147
↓ 1 callersFunctionrand_init_delta
Randomly initialize the perturbation.
core/attacks/utils.py:170
↓ 1 callersFunctionresnet
Returns suitable Resnet model from its name. Arguments: name (str): name of resnet architecture. num_classes (int): number of
core/models/resnet.py:140
↓ 1 callersFunctionset_module_training_off
(module)
core/utils/context.py:47
↓ 1 callersFunctionset_module_training_state
(module, training_state)
core/utils/context.py:42
↓ 1 callersFunctionset_param_grad_off
(module)
core/utils/context.py:61
↓ 1 callersFunctionset_param_grad_state
(module, grad_state)
core/utils/context.py:56
↓ 1 callersMethodsetup_file_logger
(self)
core/utils/logger.py:16
↓ 1 callersFunctionsquared_l2_norm
(x)
core/utils/trades.py:12
↓ 1 callersFunctionsquared_l2_norm
(x)
gowal21uncovering/utils/trades.py:12
↓ 1 callersFunctionti_preact_resnet
Returns suitable PreAct Resnet model from its name (only for TI-200 dataset). Arguments: name (str): name of resnet architecture.
core/models/ti_preact_resnet.py:109
↓ 1 callersFunctiontrades_loss
TRADES training (Zhang et al, 2019).
core/utils/trades.py:21
↓ 1 callersFunctiontrades_loss
TRADES training (Zhang et al, 2019).
gowal21uncovering/utils/trades.py:21
↓ 1 callersMethodtrades_loss
TRADES training.
core/utils/train.py:204
↓ 1 callersMethodtrades_loss
TRADES training.
gowal21uncovering/utils/watrain.py:144
next →1–100 of 206, ranked by callers