RECODE-H / annotations /annotation_101 /function_info.json
mcy98's picture
Upload folder using huggingface_hub
d7ff85b verified
Raw History Blame Contribute Delete
16.2 kB
[
{
"function_name": "_init_weights",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "isinstance",
"functionality": "Checks if an object is an instance of a specified class.",
"input": "module, (nn.Linear, nn.Embedding)",
"output": "bool",
"location_or_namespace": "built-in"
},
{
"function_call_name": "normal_",
"functionality": "Fills the tensor with elements drawn from a normal distribution.",
"input": "mean=0.0, std=self.args.initializer_range",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "zero_",
"functionality": "Fills the tensor with zeros.",
"input": "",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "fill_",
"functionality": "Fills the tensor with the specified scalar value.",
"input": "1.0",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "get_embeds",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "item_embedding",
"functionality": "Performs an embedding lookup.",
"input": "item_ids",
"output": "tensor",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "get_logits",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "matmul",
"functionality": "Performs a matrix multiplication of the inputs.",
"input": "hidden_repr, test_items_emb.transpose(0, 1)",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "transpose",
"functionality": "Returns a tensor that is a transposed version of the input tensor.",
"input": "0, 1",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "sum",
"functionality": "Returns the sum of all elements in the input tensor.",
"input": "-1",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "view",
"functionality": "Returns a new tensor with the same data but a different size.",
"input": "(-1, 1)",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "mm",
"functionality": "Performs a matrix multiplication of the input matrices.",
"input": "self.lm_head.weight, text_emb_t",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "sqrt",
"functionality": "Returns a new tensor with the square-root of the elements of the input tensor.",
"input": "th.clamp(dist, 0.0, np.inf)",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "clamp",
"functionality": "Clamps all elements in input into the range [ min, max ].",
"input": "dist, 0.0, np.inf",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "permute",
"functionality": "Returns a view of the original tensor with its dimensions permuted.",
"input": "1, 2, 0",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "contiguous",
"functionality": "Returns a contiguous version of the tensor.",
"input": "",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "NotImplementedError",
"functionality": "Raised when a method or function is not implemented.",
"input": "",
"output": "NotImplementedError",
"location_or_namespace": "built-in"
}
]
},
{
"function_name": "diffusion_reverse",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "timestep_embedding",
"functionality": "",
"input": "timesteps, self.hidden_t_dim",
"output": "tensor",
"location_or_namespace": "utils"
},
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "1",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "expand",
"functionality": "Returns a new view of the original tensor with singleton dimensions expanded to a larger size.",
"input": "-1, seq_length, -1",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "dropout",
"functionality": "Performs a dropout operation on the input tensor.",
"input": "self.ln_bert(emb_inputs)",
"output": "tensor",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "ln_bert",
"functionality": "Performs a layer normalization operation.",
"input": "emb_inputs",
"output": "tensor",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "bert_encoder",
"functionality": "Performs a forward pass through the DebertaEncoder.",
"input": "emb_inputs, attention_mask, output_hidden_states=False, output_attentions=False, return_dict=False",
"output": "tuple",
"location_or_namespace": "transformers.models.deberta.modeling_deberta"
},
{
"function_call_name": "type",
"functionality": "Returns a new tensor with the specified data type.",
"input": "x.dtype",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "add_position_embedding",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "arange",
"functionality": "Returns a 1-D tensor of size `(end - start) / step` with values from the interval `[start, end)` taken with common difference `step` starting from `start`.",
"input": "seq_length, dtype=torch.long, device=sequence.device",
"output": "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": "0",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "expand_as",
"functionality": "Expands this tensor to the same size as `other`.",
"input": "sequence",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "item_embedding",
"functionality": "Performs an embedding lookup.",
"input": "sequence",
"output": "tensor",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "position_embedding",
"functionality": "Performs an embedding lookup.",
"input": "position_ids",
"output": "tensor",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "LayerNorm",
"functionality": "Performs a layer normalization operation.",
"input": "sequence_emb",
"output": "tensor",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "dropout",
"functionality": "Performs a dropout operation.",
"input": "sequence_emb",
"output": "tensor",
"location_or_namespace": "torch.nn"
}
]
},
{
"function_name": "get_extended_attention_mask",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "unsqueeze",
"functionality": "Returns a new tensor with a dimension of size one inserted at the specified position.",
"input": "1",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "triu",
"functionality": "Returns the upper triangular part of a matrix or batch of matrices `input`, the other elements are set to 0.",
"input": "torch.ones(attn_shape), diagonal=1",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "ones",
"functionality": "Returns a tensor filled with the scalar value 1, with the shape defined by the variable argument `size`.",
"input": "attn_shape",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "long",
"functionality": "Casts the tensor to the `torch.long` data type.",
"input": "",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "cuda",
"functionality": "Returns a copy of this object in CUDA memory.",
"input": "",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "to",
"functionality": "Performs Tensor dtype and/or device conversion.",
"input": "input_ids.device",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "next",
"functionality": "Retrieves the next item from an iterator.",
"input": "self.parameters()",
"output": "Any",
"location_or_namespace": "built-in"
}
]
},
{
"function_name": "forward",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "rec_trm_encoder",
"functionality": "Performs a forward pass through the TransformerEncoder.",
"input": "seq_emb, extended_attention_mask, output_all_encoded_layers=True",
"output": "list",
"location_or_namespace": "./modules"
}
]
},
{
"function_name": "calculate_rec_loss",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "get_extended_attention_mask",
"functionality": "",
"input": "item_seq",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "add_position_embedding",
"functionality": "",
"input": "item_seq",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "forward",
"functionality": "",
"input": "sequence_emb, extended_attention_mask",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "cross_entropy",
"functionality": "",
"input": "seq_output, target_pos, target_neg",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
}
]
},
{
"function_name": "cross_entropy",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "item_embedding",
"functionality": "Performs an embedding lookup.",
"input": "pos_ids",
"output": "tensor",
"location_or_namespace": "torch.nn"
},
{
"function_call_name": "view",
"functionality": "Returns a new tensor with the same data but a different size.",
"input": "(-1, pos_emb.size(2))",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
},
{
"function_call_name": "sum",
"functionality": "Returns the sum of all elements in the input tensor.",
"input": "pos * seq_emb, -1",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "sigmoid",
"functionality": "Applies the sigmoid function element-wise.",
"input": "pos_logits",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "log",
"functionality": "Computes the natural logarithm of the input tensor element-wise.",
"input": "torch.sigmoid(pos_logits) + 1e-24",
"output": "tensor",
"location_or_namespace": "torch"
}
]
},
{
"function_name": "full_sort_predict",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "get_extended_attention_mask",
"functionality": "",
"input": "item_seq",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "add_position_embedding",
"functionality": "",
"input": "item_seq",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "forward",
"functionality": "",
"input": "sequence_emb, extended_attention_mask",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "matmul",
"functionality": "Performs a matrix multiplication of the inputs.",
"input": "seq_output, test_items_emb.transpose(0, 1)",
"output": "tensor",
"location_or_namespace": "torch"
},
{
"function_call_name": "transpose",
"functionality": "Returns a tensor that is a transposed version of the input tensor.",
"input": "0, 1",
"output": "tensor",
"location_or_namespace": "torch.Tensor"
}
]
},
{
"function_name": "calculate_cl_loss",
"file_path": "CaDiRec.py",
"function_calls": [
{
"function_call_name": "get_extended_attention_mask",
"functionality": "",
"input": "aug_seq1",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "add_position_embedding",
"functionality": "",
"input": "aug_seq1, emb1",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "forward",
"functionality": "",
"input": "aug_seq1_emb, extended_attention_mask",
"output": "tensor",
"location_or_namespace": "CaDiRec.py"
},
{
"function_call_name": "info_nce",
"functionality": "Calculates the InfoNCE contrastive learning loss logits and labels.",
"input": "seq1_output, seq2_output, temp=self.args.temperature, batch_size=aug_seq1.shape[0], sim='dot'",
"output": "tuple (tensor, tensor)",
"location_or_namespace": "./modules"
},
{
"function_call_name": "nce_fct",
"functionality": "Performs a cross-entropy loss calculation.",
"input": "nce_logits, nce_labels",
"output": "tensor",
"location_or_namespace": "torch.nn"
}
]
}
]