[ { "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" } ] } ]