MCPcopy Create free account

hub / github.com/Trustworthy-AI-Group/TransferAttack / functions

Functions2,264 in github.com/Trustworthy-AI-Group/TransferAttack

↓ 2 callersMethod_compute_norms
(self, grad_scale=1.0)
defense/diffpure/guided_diffusion/fp16_util.py:224
↓ 2 callersMethod_get_mask
(self, H, W, device, soft=False, softness=10.0)
transferattack/input_transformation/mfi.py:55
↓ 2 callersMethod_ifft
(self, X)
transferattack/input_transformation/mfi.py:75
↓ 2 callersMethod_predict_xstart_from_eps
(self, x_t, t, eps)
defense/diffpure/guided_diffusion/gaussian_diffusion.py:336
↓ 2 callersFunction_register
(cls)
defense/diffpure/score_sde/sampling.py:37
↓ 2 callersMethod_register_model
(self, add = False)
transferattack/model_related/vdc.py:61
↓ 2 callersFunction_resolve_by_patterns
(model, patterns)
transferattack/model_related/faug.py:122
↓ 2 callersMethod_resolve_dataset_root
(self, path: str)
transferattack/generation/fap.py:268
↓ 2 callersMethod_truncate
(self, s)
defense/diffpure/guided_diffusion/logger.py:88
↓ 2 callersFunctionaccuracy
Computes the accuracy over the k top predictions for the specified values of k
defense/at/lib/utils.py:41
↓ 2 callersFunctionaccuracy
Computes the accuracy over the k top predictions for the specified values of k
transferattack/model_related/qaa_utils/train.py:210
↓ 2 callersFunctionaggregate_attention
(prompts, attention_store, res: int, from_where, is_cross: bool, select: int, is_cpu=True)
transferattack/generation/diffattack.py:339
↓ 2 callersFunctionapot_quantization
(tensor, alpha, proj_set, is_weight=True, grad_scale=None)
transferattack/model_related/qaa_utils/archs/apot/quant_layer.py:67
↓ 2 callersFunctionapprox_standard_normal_cdf
A fast approximation of the cumulative distribution function of the standard normal.
defense/diffpure/guided_diffusion/losses.py:50
↓ 2 callersFunctionattack
(ILA:bool, w, ori_img, label, device, niters, baseline_method, epsilon, model, mid_layer_index, batch_size, lr
transferattack/advanced_objective/yaila/yaila_utils.py:162
↓ 2 callersFunctionbackward_hook
implement SGM through grad through ReLU (This code is copied from https://github.com/csdongxian/skip-connections-matter)
transferattack/model_related/sgm.py:47
↓ 2 callersMethodbn_function
(self, inputs)
transferattack/model_related/llta_networks/models/decaydensenet.py:45
↓ 2 callersMethodbn_function
(self, inputs)
transferattack/model_related/llta_networks/models/decaydensenet.py:114
↓ 2 callersFunctionbuild_model
(state_dict=False)
transferattack/ensemble/mba.py:70
↓ 2 callersFunctionbuild_model_with_cfg
( model_cls: Callable, variant: str, pretrained: bool, default_cfg: dict,
transferattack/model_related/ata_vit_utils/Transformer_Explainability/baselines/ViT/helpers.py:250
↓ 2 callersFunctionbuild_power_value
(B=2, additive=True)
transferattack/model_related/qaa_utils/archs/apot/quant_layer.py:12
↓ 2 callersFunctionca_forward
(self, place_in_unet)
transferattack/generation/diffattack.py:429
↓ 2 callersMethodcalculate_gradient
Calculate gradient ∇_x L(x, y; θ)
transferattack/gradient/gaa.py:129
↓ 2 callersMethodcalculate_gradient_batch
Optimized gradient calculation with caching, mixed precision and chunking to avoid OOM
transferattack/gradient/foolmix.py:248
↓ 2 callersFunctioncheckpoint
Evaluate a function without caching intermediate activations, allowing for reduced memory at the expense of extra compute in the backward pas
defense/diffpure/guided_diffusion/nn.py:132
↓ 2 callersMethodcompute_perturbation
(self, w, lb, ub)
transferattack/input_transformation/idaa.py:138
↓ 2 callersFunctioncompute_rollout_attention
(all_layer_matrices, start_layer=0)
transferattack/model_related/ata_vit_utils/Transformer_Explainability/baselines/ViT/ViT_LRP.py:38
↓ 2 callersMethodcompute_rotation
Return: rot -- torch.tensor, size (B, 3, 3) pts @ trans_mat Parameters: angles -- torc
transferattack/input_transformation/odi/odi.py:450
↓ 2 callersFunctionconfigure
If comm is provided, average all numerical stats across that comm
defense/diffpure/guided_diffusion/logger.py:450
↓ 2 callersFunctioncount_flops_attn
A counter for the `thop` package to count the operations in an attention operation. Meant to be used like: macs, params = thop.pr
defense/diffpure/guided_diffusion/unet.py:316
↓ 2 callersMethodcreate_data_task_set
(self, x, set_size, prob)
transferattack/model_related/llta_networks/llta.py:216
↓ 2 callersMethodcreate_model_task_set
(self, gammas, set_size, prob, region)
transferattack/model_related/llta_networks/llta.py:202
↓ 2 callersMethoddct
Discrete Cosine Transform (DCT)
transferattack/gradient/fgsra.py:49
↓ 2 callersMethoddct
(self, x, norm=None)
transferattack/generation/fap.py:334
↓ 2 callersMethoddct
Discrete Cosine Transform, Type II (a.k.a. the DCT) (This code is copied from https://github.com/yuyang-long/SSA/blob/master/dct.py)
transferattack/input_transformation/ssm.py:101
↓ 2 callersMethoddct
Discrete Cosine Transform, Type II (a.k.a. the DCT) (This code is copied from https://github.com/yuyang-long/SSA/blob/master/dct.py)
transferattack/input_transformation/ssm_with_tricks.py:117
↓ 2 callersMethoddct
Discrete Cosine Transform, Type II (a.k.a. the DCT) (This code is copied from https://github.com/yuyang-long/SSA/blob/master/dct.py)
transferattack/input_transformation/ssm_with_tricks.py:359
↓ 2 callersMethoddct
(self, x, norm=None)
transferattack/input_transformation/sid.py:33
↓ 2 callersMethoddct
Discrete Cosine Transform, Type II (a.k.a. the DCT) (This code is copied from https://github.com/yuyang-long/SSA/blob/master/dct.py)
transferattack/input_transformation/l2t.py:224
↓ 2 callersMethoddct_2d
(self, x, norm=None)
transferattack/generation/fap.py:372
↓ 2 callersMethoddct_2d
2-dimentional Discrete Cosine Transform, Type II (a.k.a. the DCT) (This code is copied from https://github.com/yuyang-long/SSA/blob/m
transferattack/input_transformation/ssm_with_tricks.py:436
↓ 2 callersMethoddct_2d
(self, x, norm=None)
transferattack/input_transformation/sid.py:71
↓ 2 callersFunctiondiffusion_defaults
Defaults for image and classifier training.
defense/diffpure/guided_diffusion/script_util.py:19
↓ 2 callersMethoddisplay
(self, batch)
transferattack/model_related/qaa_utils/train.py:191
↓ 2 callersMethoddumpkvs
(self)
defense/diffpure/guided_diffusion/logger.py:363
↓ 2 callersMethodfeatureExtractor
(self, x)
transferattack/model_related/metassa.py:620
↓ 2 callersMethodforward
(self, inputs)
transferattack/model_related/ata_vit_utils/Transformer_Explainability/modules/layers_ours.py:98
↓ 2 callersMethodforward
(self, x)
transferattack/model_related/llta_networks/models/__init__.py:20
↓ 2 callersMethodforward_features
(self, x)
transferattack/model_related/ana.py:48
↓ 2 callersMethodforward_from_layer3
(self, feat_layer3)
transferattack/model_related/ana.py:51
↓ 2 callersMethodgenerate_shift
(self, k, num_samples=1)
transferattack/gradient/liboost.py:58
↓ 2 callersFunctionget_blob_logdir
()
defense/diffpure/guided_diffusion/train_util.py:281
↓ 2 callersMethodget_dir
(self)
defense/diffpure/guided_diffusion/logger.py:396
↓ 2 callersMethodget_grad
Calculate gradients with respect to perturbations
transferattack/model_related/ll2s.py:530
↓ 2 callersMethodget_l2grad
(self, x, y, model, gammas)
transferattack/model_related/llta_networks/llta.py:247
↓ 2 callersFunctionget_layer
(model, name)
transferattack/model_related/dhf_networks/utils.py:54
↓ 2 callersMethodget_length
(self, length, num_block)
transferattack/input_transformation/sid.py:81
↓ 2 callersMethodget_logits_by_model_k
The inference stage, which should be overridden when the attack need to change the models (e.g., ensemble-model attack, ghost, etc.) or the i
transferattack/ensemble/svre.py:91
↓ 2 callersMethodget_loss
Calculate loss for the attack Args: logits: Model output logits label: Ground truth labels num_c
transferattack/model_related/ll2s.py:515
↓ 2 callersMethodget_loss
(self, logits, label)
transferattack/input_transformation/ssm_with_tricks.py:469
↓ 2 callersMethodget_model
(self, model_name)
transferattack/model_related/ata_vit.py:219
↓ 2 callersFunctionget_param_groups_and_shapes
(named_model_params)
defense/diffpure/guided_diffusion/fp16_util.py:90
↓ 2 callersMethodget_repeat_grad
The gradient calculation, which should be overridden when the attack need to tune the gradient (e.g., TIM, variance tuning, enhanced momentum
transferattack/gradient/mumodig.py:152
↓ 2 callersFunctionget_score_fn
Wraps `score_fn` so that the model output corresponds to a real time-dependent score function. Args: sde: An `sde_lib.SDE` object that repr
defense/diffpure/score_sde/models/utils.py:128
↓ 2 callersFunctiongkern
(kernlen=15, nsig=3)
transferattack/advanced_objective/ftm.py:395
↓ 2 callersFunctiongkern
(kernlen=15, nsig=3)
transferattack/input_transformation/everywhere.py:276
↓ 2 callersFunctiongradient_scale
(x, scale)
transferattack/model_related/qaa_utils/archs/apot/quant_layer.py:60
↓ 2 callersFunctiongrid_points_2d
(width, height, device)
transferattack/input_transformation/decowa.py:171
↓ 2 callersMethodidct
The inverse to DCT-II, which is a scaled Discrete Cosine Transform
transferattack/gradient/fgsra.py:75
↓ 2 callersMethodidct
(self, X, norm=None)
transferattack/generation/fap.py:350
↓ 2 callersMethodidct
The inverse to DCT-II, which is a scaled Discrete Cosine Transform, Type III Our definition of idct is that idct(dct(x)) == x
transferattack/input_transformation/ssm.py:135
↓ 2 callersMethodidct
The inverse to DCT-II, which is a scaled Discrete Cosine Transform, Type III Our definition of idct is that idct(dct(x)) == x
transferattack/input_transformation/ssm_with_tricks.py:151
↓ 2 callersMethodidct
The inverse to DCT-II, which is a scaled Discrete Cosine Transform, Type III Our definition of idct is that idct(dct(x)) == x
transferattack/input_transformation/ssm_with_tricks.py:393
↓ 2 callersMethodidct
(self, x, norm=None)
transferattack/input_transformation/sid.py:49
↓ 2 callersMethodidct
The inverse to DCT-II, which is a scaled Discrete Cosine Transform, Type III Our definition of idct is that idct(dct(x)) == x
transferattack/input_transformation/l2t.py:258
↓ 2 callersMethodidct_2d
(self, X, norm=None)
transferattack/generation/fap.py:377
↓ 2 callersMethodidct_2d
The inverse to 2D DCT-II, which is a scaled Discrete Cosine Transform, Type III Our definition of idct is that idct_2d(dct_2d(x)) ==
transferattack/input_transformation/ssm_with_tricks.py:452
↓ 2 callersFunctionjpeg2png
(name)
transferattack/model_related/qaa_utils/utils.py:36
↓ 2 callersMethodlattack_loss
(self, x_adv, label, **kwargs)
transferattack/input_transformation/atta.py:53
↓ 2 callersMethodldsde_fn
Create the drift and diffusion functions for the reverse SDE
defense/diffpure/runners/diffpure_ldsde.py:92
↓ 2 callersFunctionlinbp_relu
(x)
transferattack/model_related/linbp.py:158
↓ 2 callersFunctionload_labels
(file_name, targeted=False)
defense/check_output.py:11
↓ 2 callersFunctionload_labels
(file_name,header=None)
defense/at/com_acc.py:5
↓ 2 callersMethodload_labels
(self, file_name)
transferattack/model_related/ata_vit.py:223
↓ 2 callersMethodload_model
Load the NAT generator model from HuggingFace or local checkpoint Arguments: model_name (str): the name of surro
transferattack/generation/nat.py:51
↓ 2 callersFunctionmake_master_params
Copy model parameters into a (differently-shaped) list of full-precision parameters.
defense/diffpure/guided_diffusion/fp16_util.py:43
↓ 2 callersFunctionnorm_cdf
(x)
transferattack/model_related/ata_vit_utils/Transformer_Explainability/baselines/ViT/weight_init.py:9
↓ 2 callersFunctionnormal_kl
Compute the KL divergence between two gaussians. Shapes are automatically broadcasted, so batches can be compared to scalars, among othe
defense/diffpure/guided_diffusion/losses.py:20
↓ 2 callersMethodp_sample
Sample x_{t-1} from the model at the given timestep. :param model: the model to sample from. :param x: the current tensor at
defense/diffpure/guided_diffusion/gaussian_diffusion.py:403
↓ 2 callersFunctionpower_quant
(x, value_s)
transferattack/model_related/qaa_utils/archs/apot/quant_layer.py:68
↓ 2 callersFunctionpreprocess
(image, res=512)
transferattack/generation/diffattack.py:352
↓ 2 callersMethodprior_sampling
Generate one sample from the prior distribution, $p_T(x)$.
defense/diffpure/score_sde/sde_lib.py:43
↓ 2 callersMethodprm_exp
(self, x)
transferattack/model_related/setr_networks/token_performer.py:31
↓ 2 callersMethodq_sample
Diffuse the data for a given number of diffusion steps. In other words, sample from q(x_t | x_0). :param x_start: the initi
defense/diffpure/guided_diffusion/gaussian_diffusion.py:196
↓ 2 callersMethodrand_bbox
(self, shape_size, ws=None, hs=None)
transferattack/input_transformation/idaa.py:93
↓ 2 callersMethodreset
(self)
transferattack/generation/diffattack.py:721
↓ 2 callersFunctionreshape_batch_dim_to_heads
(tensor)
transferattack/generation/diffattack.py:493
↓ 2 callersFunctionresnet50
r"""ResNet-50 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>'_ Args: pretrained (bo
transferattack/model_related/qaa_utils/archs/apot/resnet.py:301
↓ 2 callersFunctionresnet50
r"""ResNet-50 model from `"Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>`_ Args: pretrained (b
transferattack/model_related/llta_networks/models/decayresnet.py:347
↓ 2 callersMethodrvpsde_fn
Create the drift and diffusion functions for the reverse SDE
defense/diffpure/runners/diffpure_sde.py:92
← previousnext →201–300 of 2,264, ranked by callers