RECODE-H / annotations /annotation_30 /function_info.json
mcy98's picture
Upload folder using huggingface_hub
e89a301 verified
Raw History Blame Contribute Delete
10.3 kB
[
{
"function_name": "__init__",
"file_path": "canonical.py (ARC class)",
"function_calls": [
{
"function_call_name": "super",
"functionality": "Initialize the base class for ARC, which is nn.Module.",
"input": "ARC, self",
"output": "None",
"location_or_namespace": "builtins"
},
{
"function_call_name": "nn.ModuleList",
"functionality": "Container module for storing an ordered list of submodules (used for storing layers).",
"input": "",
"output": "ModuleList object",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "getattr",
"functionality": "Return the named attribute of an object (used here to get activation function by name).",
"input": "nn, activation",
"output": "activation function",
"location_or_namespace": "builtins"
},
{
"function_call_name": "nn.Linear",
"functionality": "Applies a linear transformation to the incoming data.",
"input": "in_features, out_features",
"output": "Linear layer",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "nn.Dropout",
"functionality": "Randomly zeroes some of the elements of the input tensor with probability dropout_rate.",
"input": "dropout_rate",
"output": "Dropout module",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "nn.Identity",
"functionality": "A placeholder identity operator that is argument-insensitive.",
"input": "",
"output": "Identity module",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "CrossAttn",
"functionality": "",
"input": "h_feats * num_hops",
"output": "CrossAttn object",
"location_or_namespace": "canonical.py"
}
]
},
{
"function_name": "forward",
"file_path": "canonical.py (ARC class)",
"function_calls": [
{
"function_call_name": "self.dropout",
"functionality": "",
"input": "x",
"output": "Tensor after dropout or identity",
"location_or_namespace": "canonical.py"
},
{
"function_call_name": "layer",
"functionality": "",
"input": "x",
"output": "Transformed tensor",
"location_or_namespace": ""
},
{
"function_call_name": "self.act",
"functionality": "",
"input": "x",
"output": "Activated tensor",
"location_or_namespace": ""
},
{
"function_call_name": "torch.hstack",
"functionality": "Stack tensors in sequence horizontally (column wise).",
"input": "residual_list",
"output": "Stacked tensor",
"location_or_namespace": "torch"
}
]
},
{
"function_name": "__init__",
"file_path": "canonical.py (CrossAttn class)",
"function_calls": [
{
"function_call_name": "super",
"functionality": "Initialize the base class for CrossAttn, which is nn.Module.",
"input": "CrossAttn, self",
"output": "None",
"location_or_namespace": "builtins"
},
{
"function_call_name": "nn.Linear",
"functionality": "Applies a linear transformation to the incoming data.",
"input": "embedding_dim, embedding_dim",
"output": "Linear layer",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "cross_attention",
"file_path": "canonical.py (CrossAttn class)",
"function_calls": [
{
"function_call_name": "self.Wq",
"functionality": "",
"input": "query_X",
"output": "Transformed query tensor",
"location_or_namespace": "canonical.py"
},
{
"function_call_name": "self.Wk",
"functionality": "",
"input": "support_X",
"output": "Transformed key tensor",
"location_or_namespace": "canonical.py"
},
{
"function_call_name": "torch.matmul",
"functionality": "Performs matrix multiplication between input tensors.",
"input": "Q, K.transpose(0, 1)",
"output": "Matrix product",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.sqrt",
"functionality": "Computes the square root of each element in the input tensor.",
"input": "torch.tensor(self.embedding_dim, dtype=torch.float32)",
"output": "Tensor with sqrt computed",
"location_or_namespace": "torch"
},
{
"function_call_name": "F.softmax",
"functionality": "Applies the Softmax function to an n-dimensional input tensor rescaling them so that the element of the n-dimensional output tensor lie in the range [0, 1] and sum to 1.",
"input": "attention_scores, dim=1",
"output": "Softmaxed tensor",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "torch.matmul",
"functionality": "Performs matrix multiplication between input tensors.",
"input": "attention_weights, support_X",
"output": "Weighted query embeddings",
"location_or_namespace": "torch"
}
]
},
{
"function_name": "get_train_loss",
"file_path": "canonical.py (CrossAttn class)",
"function_calls": [
{
"function_call_name": "torch.nonzero",
"functionality": "Returns a tensor containing the indices of non-zero elements.",
"input": "(y == 1) or (y == 0)",
"output": "Indices tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "random.sample",
"functionality": "Return a k length list of unique elements chosen from the population sequence.",
"input": "all_negative_indices, len(positive_indices)",
"output": "Random sample list",
"location_or_namespace": "random"
},
{
"function_call_name": "torch.vstack",
"functionality": "Stack tensors in sequence vertically (row wise).",
"input": "[query_p_embed, query_n_embed]",
"output": "Stacked tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "set",
"functionality": "Returns a new set object, optionally with elements taken from iterable.",
"input": "all_negative_indices",
"output": "Set object",
"location_or_namespace": "builtins"
},
{
"function_call_name": "random.sample",
"functionality": "Return a k length list of unique elements chosen from the population sequence.",
"input": "remaining_negative_indices, num_prompt",
"output": "Random sample list",
"location_or_namespace": "random"
},
{
"function_call_name": "torch.tensor",
"functionality": "Constructs a tensor object.",
"input": "support_indices",
"output": "Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "to",
"functionality": "Moves and/or casts the parameters and buffers.",
"input": "y.device",
"output": "Tensor on device",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self.cross_attention",
"functionality": "Computes cross-attention between query and support embeddings.",
"input": "query_embed, support_embed",
"output": "Weighted query embeddings",
"location_or_namespace": "canonical.py"
},
{
"function_call_name": "torch.ones",
"functionality": "Returns a tensor filled with the scalar value 1.",
"input": "[len(negative_indices)]",
"output": "Tensor of ones",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.ones",
"functionality": "Returns a tensor filled with the scalar value 1 (negated for abnormal).",
"input": "[len(positive_indices)]",
"output": "Tensor of ones",
"location_or_namespace": "torch"
},
{
"function_call_name": "to",
"functionality": "Moves and/or casts the parameters and buffers.",
"input": "y.device",
"output": "Tensor on device",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "F.cosine_embedding_loss",
"functionality": "Measures the loss given input tensors and a label tensor.",
"input": "(query_n_embed, tilde_n_embeds, yp) or (query_p_embed, tilde_p_embeds, yn)",
"output": "Scalar loss",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "torch.mean",
"functionality": "Computes the mean of input tensor.",
"input": "loss_qp + loss_qn",
"output": "Mean value",
"location_or_namespace": "torch"
}
]
},
{
"function_name": "get_test_score",
"file_path": "canonical.py (CrossAttn class)",
"function_calls": [
{
"function_call_name": "torch.nonzero",
"functionality": "Returns a tensor containing the indices of non-zero elements.",
"input": "(prompt_mask == True) & (y == 0) or (prompt_mask == False)",
"output": "Indices tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "self.cross_attention",
"functionality": "Computes cross-attention between query and support embeddings.",
"input": "query_embed, n_support_embed",
"output": "Weighted query embeddings",
"location_or_namespace": "canonical.py"
},
{
"function_call_name": "torch.sqrt",
"functionality": "Computes the square root of each element in the input tensor.",
"input": "torch.sum(diff ** 2, dim=1)",
"output": "Tensor with sqrt computed",
"location_or_namespace": "torch"
},
{
"function_call_name": "torch.sum",
"functionality": "Returns the sum of each row of the input tensor.",
"input": "diff ** 2, dim=1",
"output": "Sum tensor",
"location_or_namespace": "torch"
}
]
}
]