[ { "function_name": "MyModel.__init__", "file_path": "model.py", "function_calls": [ { "function_call_name": "super().__init__", "functionality": "Initializes the parent class (nn.Module).", "input": "", "output": "", "location_or_namespace": "torch.nn.Module" }, { "function_call_name": "nn.PReLU", "functionality": "Creates a PReLU activation layer.", "input": "", "output": "PReLU activation layer object", "location_or_namespace": "torch.nn" }, { "function_call_name": "self._build_up", "functionality": "Builds the layers of the MyModel network.", "input": "in_channels, out_channels, num_proj_hidden, temperature", "output": "", "location_or_namespace": "model.py" } ] }, { "function_name": "MyModel.forward", "file_path": "model.py", "function_calls": [ { "function_call_name": "self.activation", "functionality": "Applies the configured activation function (e.g., PReLU).", "input": "tensor", "output": "tensor", "location_or_namespace": "torch.nn.modules.activation" }, { "function_call_name": "self.conv1", "functionality": "Applies the first GCN convolutional layer.", "input": "x, edge_index", "output": "tensor", "location_or_namespace": "torch_geometric.nn.conv.gcn_conv.GCNConv" }, { "function_call_name": "self.conv2", "functionality": "Applies the second GCN convolutional layer.", "input": "out, edge_index", "output": "tensor", "location_or_namespace": "torch_geometric.nn.conv.gcn_conv.GCNConv" }, { "function_call_name": "F.relu", "functionality": "Applies the ReLU activation function.", "input": "tensor", "output": "tensor", "location_or_namespace": "torch.nn.functional" }, { "function_call_name": "self.fc1", "functionality": "Applies the first fully connected layer.", "input": "out", "output": "tensor", "location_or_namespace": "torch.nn.modules.linear.Linear" }, { "function_call_name": "self.fc2", "functionality": "Applies the second fully connected layer.", "input": "proj", "output": "tensor", "location_or_namespace": "torch.nn.modules.linear.Linear" } ] }, { "function_name": "MyModel.loss", "file_path": "model.py", "function_calls": [ { "function_call_name": "self.cal_loss", "functionality": "Calculates a unidirectional contrastive loss between two embeddings.", "input": "z1, z2, batch_compute, batch_size", "output": "tensor (loss values)", "location_or_namespace": "model.py" }, { "function_call_name": "l.mean", "functionality": "Computes the mean of the loss tensor.", "input": "", "output": "scalar tensor", "location_or_namespace": "torch.Tensor" } ] }, { "function_name": "MyModel.cal_sim", "file_path": "model.py", "function_calls": [ { "function_call_name": "F.normalize", "functionality": "Normalizes the input tensor along a given dimension.", "input": "tensor", "output": "tensor", "location_or_namespace": "torch.nn.functional" }, { "function_call_name": "torch.mm", "functionality": "Performs a matrix multiplication of two tensors.", "input": "z1, z2.t()", "output": "tensor", "location_or_namespace": "torch" }, { "function_call_name": "torch.exp", "functionality": "Computes the exponential of each element in the input tensor.", "input": "tensor", "output": "tensor", "location_or_namespace": "torch" } ] }, { "function_name": "MyModel.cal_loss", "file_path": "model.py", "function_calls": [ { "function_call_name": "z1.device", "functionality": "Gets the device of the tensor z1.", "input": "", "output": "torch.device", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "z1.size", "functionality": "Gets the size of the tensor z1.", "input": "0", "output": "int", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "torch.arange", "functionality": "Creates a 1-D tensor of size (end - start) / step with values from the interval [start, end).", "input": "0, num_nodes", "output": "tensor", "location_or_namespace": "torch" }, { "function_call_name": "torch.randperm", "functionality": "Returns a random permutation of integers from 0 to n - 1.", "input": "num_nodes", "output": "tensor", "location_or_namespace": "torch" }, { "function_call_name": "tensor.to", "functionality": "Moves the tensor to the specified device.", "input": "device", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "self.cal_sim", "functionality": "Calculates the similarity matrix between two embeddings.", "input": "z1[mask], z1 (or z2 or z1[mask] or z2[mask])", "output": "tensor (similarity matrix)", "location_or_namespace": "model.py" }, { "function_call_name": "torch.log", "functionality": "Computes the natural logarithm of each element in the input tensor.", "input": "tensor", "output": "tensor", "location_or_namespace": "torch" }, { "function_call_name": "tensor.diag", "functionality": "Returns a 1-D tensor with the diagonal elements of the input tensor.", "input": "", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "tensor.sum", "functionality": "Computes the sum of elements in the tensor along the given dimension.", "input": "1", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "torch.cat", "functionality": "Concatenates the given sequence of tensors in the given dimension.", "input": "losses", "output": "tensor", "location_or_namespace": "torch" } ] }, { "function_name": "MyModel._build_up", "file_path": "model.py", "function_calls": [ { "function_call_name": "GCNConv", "functionality": "Creates a Graph Convolutional Network layer.", "input": "in_channels, 2 * out_channels (or 2 * out_channels, out_channels)", "output": "GCNConv layer object", "location_or_namespace": "torch_geometric.nn" }, { "function_call_name": "nn.Linear", "functionality": "Creates a linear transformation layer.", "input": "out_channels, num_proj_hidden (or num_proj_hidden, out_channels)", "output": "Linear layer object", "location_or_namespace": "torch.nn" } ] }, { "function_name": "MyModel.freeze", "file_path": "model.py", "function_calls": [ { "function_call_name": "self.parameters", "functionality": "Returns an iterator over module parameters.", "input": "", "output": "iterator", "location_or_namespace": "torch.nn.Module" } ] }, { "function_name": "LinearClassifier.__init__", "file_path": "model.py", "function_calls": [ { "function_call_name": "super().__init__", "functionality": "Initializes the parent class (nn.Module).", "input": "", "output": "", "location_or_namespace": "torch.nn.Module" }, { "function_call_name": "nn.Linear", "functionality": "Creates a linear transformation layer.", "input": "feat_dim, classes_num", "output": "Linear layer object", "location_or_namespace": "torch.nn" } ] }, { "function_name": "LinearClassifier.weights_init", "file_path": "model.py", "function_calls": [ { "function_call_name": "isinstance", "functionality": "Checks if an object is an instance of a class or of a subclass thereof.", "input": "m, nn.Linear", "output": "bool", "location_or_namespace": "builtins" }, { "function_call_name": "nn.init.xavier_uniform_", "functionality": "Fills the input Tensor with values according to the method described in 'Understanding the difficulty of training deep feedforward neural networks' - Glorot, X. & Bengio, Y. (2010).", "input": "m.weight.data", "output": "tensor (modified in-place)", "location_or_namespace": "torch.nn.init" }, { "function_call_name": "m.bias.data.fill_", "functionality": "Fills the tensor with the specified value.", "input": "0.0", "output": "tensor (modified in-place)", "location_or_namespace": "torch.Tensor" } ] }, { "function_name": "LinearClassifier.forward", "file_path": "model.py", "function_calls": [ { "function_call_name": "self.fc", "functionality": "Applies the fully connected layer.", "input": "x", "output": "tensor", "location_or_namespace": "torch.nn.modules.linear.Linear" } ] } ]