RECODE-H / annotations /annotation_15 /function_info.json
mcy98's picture
Add files using upload-large-folder tool
83e8056 verified
Raw History Blame Contribute Delete
12.6 kB
[
{
"function_name": "__init__",
"file_path": "graphmetro/moe_model.py",
"function_calls": [
{
"function_call_name": "super().__init__",
"functionality": "Initializes the base nn.Module class.",
"input": "()",
"output": "None",
"location_or_namespace": "torch.nn.Module"
},
{
"function_call_name": "len",
"functionality": "Returns the number of items in a dictionary.",
"input": "trans_func_dict",
"output": "int",
"location_or_namespace": "builtins"
},
{
"function_call_name": "list",
"functionality": "Converts dictionary values to a list.",
"input": "trans_func_dict.values()",
"output": "list",
"location_or_namespace": "builtins"
},
{
"function_call_name": "list",
"functionality": "Converts dictionary keys to a list.",
"input": "trans_func_dict.keys()",
"output": "list",
"location_or_namespace": "builtins"
},
{
"function_call_name": "range",
"functionality": "Generates a sequence of numbers.",
"input": "self.num_experts",
"output": "range",
"location_or_namespace": "builtins"
}
]
},
{
"function_name": "_aggregate",
"file_path": "graphmetro/moe_model.py",
"function_calls": [
{
"function_call_name": "self.experts[i].encoder",
"functionality": "Encodes the graph data for a specific expert.",
"input": "data.x, data.edge_index, data.edge_attr, data.batch",
"output": "torch.Tensor",
"location_or_namespace": ""
},
{
"function_call_name": "unsqueeze",
"functionality": "Adds a dimension to a tensor.",
"input": "dim=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "append",
"functionality": "Adds an element to a list.",
"input": "emb",
"output": "None",
"location_or_namespace": "builtins.list"
},
{
"function_call_name": "torch.concat",
"functionality": "Concatenates a sequence of tensors along a given dimension.",
"input": "embs, dim=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "size",
"functionality": "Returns the size of the tensor.",
"input": "0",
"output": "torch.Size",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.unique",
"functionality": "Returns the unique elements of a tensor.",
"input": "data.batch",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "len",
"functionality": "Returns the length of an object.",
"input": "torch.unique(data.batch)",
"output": "int",
"location_or_namespace": "builtins"
},
{
"function_call_name": "isinstance",
"functionality": "Checks if an object is an instance of a class.",
"input": "weights_or_labels, (int, np.int64)",
"output": "bool",
"location_or_namespace": "builtins"
},
{
"function_call_name": "torch.LongTensor",
"functionality": "Creates a LongTensor.",
"input": "[weights_or_labels for _ in range(length)]",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "len",
"functionality": "Returns the length of an object.",
"input": "weights_or_labels.size()",
"output": "int",
"location_or_namespace": "builtins"
},
{
"function_call_name": "copy.deepcopy",
"functionality": "Creates a deep copy of an object.",
"input": "weights_or_labels",
"output": "torch.Tensor",
"location_or_namespace": "copy"
},
{
"function_call_name": "torch.zeros",
"functionality": "Creates a tensor filled with zeros.",
"input": "(length, self.num_experts)",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "to",
"functionality": "Moves the tensor to a specified device.",
"input": "cfg.device",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "range",
"functionality": "Generates a sequence of numbers.",
"input": "length",
"output": "range",
"location_or_namespace": "builtins"
},
{
"function_call_name": "argmax",
"functionality": "Returns the indices of the maximum values along a dimension.",
"input": "dim=1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "bool",
"functionality": "Casts the tensor to boolean type.",
"input": "()",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.zeros_like",
"functionality": "Creates a tensor filled with zeros, with the same size as input.",
"input": "weights_or_labels",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "unsqueeze",
"functionality": "Adds a dimension to a tensor.",
"input": "dim=2",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "torch.bmm",
"functionality": "Performs batch matrix-matrix product.",
"input": "embs, weights",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "squeeze",
"functionality": "Removes a dimension from a tensor.",
"input": "dim=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "get_expert_weights",
"file_path": "graphmetro/moe_model.py",
"function_calls": [
{
"function_call_name": "self.gating_model",
"functionality": "Computes expert weights using the gating model.",
"input": "trans_data.x, trans_data.edge_index, trans_data.edge_attr, trans_data.batch",
"output": "torch.Tensor",
"location_or_namespace": ""
},
{
"function_call_name": "softmax",
"functionality": "Applies the softmax function.",
"input": "dim=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "forward",
"file_path": "graphmetro/moe_model.py",
"function_calls": [
{
"function_call_name": "self.get_expert_weights",
"functionality": "Computes expert weights using the gating model.",
"input": "trans_data, softmax=True",
"output": "torch.Tensor",
"location_or_namespace": "graphmetro/moe_model.py"
},
{
"function_call_name": "argmax",
"functionality": "Returns the indices of the maximum values along a dimension.",
"input": "dim=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "view",
"functionality": "Returns a new tensor with the same data but different size.",
"input": "-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self._aggregate",
"functionality": "Aggregates expert outputs based on weights.",
"input": "trans_data, expert_weights, hard",
"output": "torch.Tensor",
"location_or_namespace": "graphmetro/moe_model.py"
},
{
"function_call_name": "self.classifier",
"functionality": "Classifies the aggregated embedding.",
"input": "new_z",
"output": "torch.Tensor",
"location_or_namespace": ""
},
{
"function_call_name": "torch.zeros_like",
"functionality": "Creates a tensor filled with zeros, with the same size as input.",
"input": "expert_weights",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "range",
"functionality": "Generates a sequence of numbers.",
"input": "expert_weights.size(0)",
"output": "range",
"location_or_namespace": "builtins"
}
]
},
{
"function_name": "losses",
"file_path": "graphmetro/moe_model.py",
"function_calls": [
{
"function_call_name": "self.get_expert_weights",
"functionality": "Computes expert weights using the gating model.",
"input": "trans_data, softmax=False",
"output": "torch.Tensor",
"location_or_namespace": "graphmetro/moe_model.py"
},
{
"function_call_name": "repeat",
"functionality": "Repeats the tensor along specified dimensions.",
"input": "expert_weights.size(0), 1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "to",
"functionality": "Moves the tensor to a specified device.",
"input": "cfg.device",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "print",
"functionality": "Prints objects to the text stream.",
"input": "'Added pos_weight=5'",
"output": "None",
"location_or_namespace": "builtins"
},
{
"function_call_name": "F.binary_cross_entropy_with_logits",
"functionality": "Computes Binary Cross Entropy loss with logits.",
"input": "expert_weights, target, pos_weight=torch.Tensor([4.]).to(expert_weights.device)",
"output": "torch.Tensor",
"location_or_namespace": "torch.nn.functional"
},
{
"function_call_name": "torch.Tensor",
"functionality": "Creates a Tensor.",
"input": "[4.]",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "sigmoid",
"functionality": "Applies the sigmoid function.",
"input": "()",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "float",
"functionality": "Casts the tensor to float type.",
"input": "()",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "mean",
"functionality": "Computes the mean of the tensor.",
"input": "()",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "detach",
"functionality": "Detaches the tensor from the computation graph.",
"input": "()",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "softmax",
"functionality": "Applies the softmax function.",
"input": "dim=-1",
"output": "torch.Tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "self._aggregate",
"functionality": "Aggregates expert outputs based on weights.",
"input": "trans_data, expert_weights_detached, hard",
"output": "torch.Tensor",
"location_or_namespace": "graphmetro/moe_model.py"
},
{
"function_call_name": "torch.unique",
"functionality": "Returns the unique elements of a tensor.",
"input": "data.batch",
"output": "torch.Tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "len",
"functionality": "Returns the length of an object.",
"input": "torch.unique(data.batch)",
"output": "int",
"location_or_namespace": "builtins"
},
{
"function_call_name": "torch.linalg.norm",
"functionality": "Computes the matrix or vector norm.",
"input": "new_zs - gt_zs_base, 'fro'",
"output": "torch.Tensor",
"location_or_namespace": "torch.linalg"
}
]
}
]