File size: 13,592 Bytes
e89a301 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | [
{
"function_name": "fast_find_matrix_around_image",
"file_path": "targeting.py",
"function_calls": [
{
"function_call_name": "repeat_interleave",
"functionality": "Repeats elements of a tensor.",
"input": "images.detach().clone().cpu(), inxs.shape[1], dim=0",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "detach",
"functionality": "Detaches the tensor from the current computational graph.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "clone",
"functionality": "Returns a copy of the tensor.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cpu",
"functionality": "Moves the tensor to CPU memory.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "to_one_hot",
"functionality": "Converts a tensor of class indices to one-hot vectors.",
"input": "inxs, num_classes=num_classes",
"output": "torch.Tensor",
"location_or_namespace": "utils.py"
},
{
"function_call_name": "repeat_interleave",
"functionality": "Repeats elements of a tensor.",
"input": "targets, inxs.shape[1], dim=0",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "detach",
"functionality": "Detaches the tensor from the current computational graph.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "scatter",
"functionality": "Writes all values from the `src` tensor into `self` at the indices specified in the `index` tensor.",
"input": "dim=1, index=targets_repeated.unsqueeze(1), value=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "type",
"functionality": "Casts a tensor to a specified data type.",
"input": "torch.FloatTensor",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "batch_gradient_w_loss",
"functionality": "Computes gradients of the model output with respect to the input in mini-batches.",
"input": "model, images_repeated, eye, batch_size=batch_size",
"output": "torch.Tensor",
"location_or_namespace": "targeting.py"
},
{
"function_call_name": "reshape",
"functionality": "Returns a tensor with the same data and number of elements as `self` but with the specified shape.",
"input": "(images.shape[0], inxs.shape[-1], images.shape[-3] * images.shape[-2] * images.shape[-1])",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "batch_gradient_w_loss",
"file_path": "targeting.py",
"function_calls": [
{
"function_call_name": "tensor",
"functionality": "Creates a tensor.",
"input": "[]",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "cuda",
"functionality": "Moves the tensor to CUDA memory (GPU).",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "enable_grad",
"functionality": "Context-manager that enables gradient calculation.",
"input": "",
"output": "Context manager",
"location_or_namespace": "torch"
},
{
"function_call_name": "zero_grad",
"functionality": "Zeros the gradients of all model parameters.",
"input": "set_to_none=True",
"output": "None",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "Parameter",
"functionality": "A kind of Tensor that is to be considered a learnable parameter.",
"input": "batch_inputs",
"output": "torch.nn.Parameter",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "requires_grad_",
"functionality": "Changes whether the tensor requires gradient.",
"input": "True",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "forward",
"functionality": "Performs the forward pass of the model.",
"input": "batch_inputs",
"output": "torch.Tensor",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "backward",
"functionality": "Computes the gradient of current tensor w.r.t. graph leaves.",
"input": "batch_backward_var",
"output": "None",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "detach",
"functionality": "Detaches the tensor from the current computational graph.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor.grad"
},
{
"function_call_name": "clone",
"functionality": "Returns a copy of the tensor.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cpu",
"functionality": "Moves the tensor to CPU memory.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cat",
"functionality": "Concatenates the given sequence of `seq` tensors in the given dimension `dim`.",
"input": "(grads, g), dim=0",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "zero_",
"functionality": "Fills `self` with zeros.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor.grad"
},
{
"function_call_name": "detach",
"functionality": "Detaches the tensor from the current computational graph.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "get_class_rank",
"file_path": "targeting.py",
"function_calls": [
{
"function_call_name": "zeros",
"functionality": "Returns a tensor filled with the scalar value 0, with the shape defined by `size`.",
"input": "(x.shape[0], next_topk_inxs.shape[-1]), dtype=type",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "repeat_interleave",
"functionality": "Repeats elements of a tensor.",
"input": "src_classes_scores, next_topk_inxs.shape[-1], dim=1",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "arange",
"functionality": "Returns a 1-D tensor of size `(end-start)/step` with values from `start` to `end` with step `step`.",
"input": "srcoutput.shape[0]",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "norm",
"functionality": "Returns the matrix norm or vector norm of a given tensor.",
"input": "matrix_raw_diffs, p=2, dim=2",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "norm",
"functionality": "Returns the matrix norm or vector norm of a given tensor.",
"input": "matrix_raw_diffs, p=1, dim=2",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "sum",
"functionality": "Returns the sum of all elements in the input tensor.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cpu",
"functionality": "Moves the tensor to CPU memory.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cpu",
"functionality": "Moves the tensor to CPU memory.",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "ones",
"functionality": "Returns a tensor filled with the scalar value 1, with the shape defined by `size`.",
"input": "x.shape[0], srcoutput.shape[-1]",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "arange",
"functionality": "Returns a 1-D tensor of size `(end-start)/step` with values from `start` to `end` with step `step`.",
"input": "x.shape[0]",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "get_k_best_target_classes",
"file_path": "targeting.py",
"function_calls": [
{
"function_call_name": "no_grad",
"functionality": "Context-manager that disables gradient calculation.",
"input": "",
"output": "Context manager",
"location_or_namespace": "torch"
},
{
"function_call_name": "forward",
"functionality": "Performs the forward pass of the model.",
"input": "data",
"output": "torch.Tensor",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "max",
"functionality": "Returns the maximum value of all elements in the `input` tensor.",
"input": "srcoutput, dim=1",
"output": "Tuple[torch.Tensor, torch.Tensor]",
"location_or_namespace": "torch"
},
{
"function_call_name": "scatter",
"functionality": "Writes all values from the `src` tensor into `self` at the indices specified in the `index` tensor.",
"input": "dim=1, index=target.unsqueeze(1), value=-float(\"inf\")",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "topk",
"functionality": "Returns the `k` largest elements of the given `input` tensor along a given dimension.",
"input": "n_srcoutput, k=testk, dim=1",
"output": "Tuple[torch.Tensor, torch.Tensor]",
"location_or_namespace": "torch"
},
{
"function_call_name": "fast_find_matrix_around_image",
"functionality": "Calculates the Jacobian (gradients of model output w.r.t. input) for selected target classes.",
"input": "data, target, next_topk_inxs, model, num_classes=srcoutput.shape[-1], batch_size=batch_size",
"output": "torch.Tensor",
"location_or_namespace": "targeting.py"
},
{
"function_call_name": "get_class_rank",
"functionality": "Calculates the MALT score for candidate target classes.",
"input": "data, next_topk_inxs, ord, linmatrix, srcoutput, srcclass, type=torch.float",
"output": "torch.Tensor",
"location_or_namespace": "targeting.py"
},
{
"function_call_name": "topk",
"functionality": "Returns the `k` largest elements of the given `input` tensor along a given dimension.",
"input": "dim=1, largest=False, k=topk",
"output": "Tuple[torch.Tensor, torch.Tensor]",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cuda",
"functionality": "Moves the tensor to CUDA memory (GPU).",
"input": "",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
}
]
}
] |