[ { "function_name": "MyModel.__init__", "file_path": "Provided_Code", "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 layer object", "location_or_namespace": "torch.nn" }, { "function_call_name": "self._build_up", "functionality": "Helper function to build GCN and fully connected layers.", "input": "in_channels, out_channels, num_proj_hidden, temperature", "output": "", "location_or_namespace": "Provided_Code" } ] }, { "function_name": "MyModel.forward", "file_path": "Provided_Code", "function_calls": [ { "function_call_name": "self.activation", "functionality": "Applies the 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 layer.", "input": "x, edge_index", "output": "tensor", "location_or_namespace": "torch_geometric.nn.conv.GCNConv" }, { "function_call_name": "self.conv2", "functionality": "Applies the second GCN layer.", "input": "out, edge_index", "output": "tensor", "location_or_namespace": "torch_geometric.nn.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": "Provided_Code", "function_calls": [ { "function_call_name": "self.cal_loss", "functionality": "Calculates one direction of the contrastive loss.", "input": "z1, z2, batch_compute, batch_size", "output": "tensor", "location_or_namespace": "Provided_Code" }, { "function_call_name": "l.mean", "functionality": "Computes the mean of the loss tensor.", "input": "", "output": "tensor", "location_or_namespace": "torch.Tensor" } ] }, { "function_name": "MyModel.cal_sim", "file_path": "Provided_Code", "function_calls": [ { "function_call_name": "F.normalize", "functionality": "Normalizes the input tensor.", "input": "tensor", "output": "tensor", "location_or_namespace": "torch.nn.functional" }, { "function_call_name": "z2.t", "functionality": "Transposes the tensor z2.", "input": "", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "torch.mm", "functionality": "Performs matrix multiplication.", "input": "z1, z2_transposed", "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": "Provided_Code", "function_calls": [ { "function_call_name": "z1.device", "functionality": "Gets the device of the tensor z1.", "input": "", "output": "device object", "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 integers from 0 to num_nodes-1.", "input": "0, num_nodes", "output": "tensor", "location_or_namespace": "torch" }, { "function_call_name": "indices.to", "functionality": "Moves the tensor to the specified device.", "input": "device", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "torch.randperm", "functionality": "Creates a random permutation of integers from 0 to num_nodes-1.", "input": "num_nodes", "output": "tensor", "location_or_namespace": "torch" }, { "function_call_name": "range", "functionality": "Generates a sequence of numbers for iteration.", "input": "num_batches", "output": "iterator", "location_or_namespace": "builtins" }, { "function_call_name": "self.cal_sim", "functionality": "Calculates the similarity matrix between two sets of embeddings.", "input": "tensor1, tensor2", "output": "tensor", "location_or_namespace": "Provided_Code" }, { "function_call_name": "losses.append", "functionality": "Appends an element to the list.", "input": "tensor", "output": "", "location_or_namespace": "builtins.list" }, { "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": "Gets the diagonal elements of the tensor.", "input": "", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "tensor.sum", "functionality": "Computes the sum of elements in the tensor along a dimension.", "input": "1", "output": "tensor", "location_or_namespace": "torch.Tensor" }, { "function_call_name": "torch.cat", "functionality": "Concatenates a sequence of tensors.", "input": "losses", "output": "tensor", "location_or_namespace": "torch" } ] }, { "function_name": "MyModel._build_up", "file_path": "Provided_Code", "function_calls": [ { "function_call_name": "GCNConv", "functionality": "Creates a Graph Convolutional Network layer.", "input": "in_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": "in_features, out_features", "output": "Linear layer object", "location_or_namespace": "torch.nn" } ] }, { "function_name": "MyModel.freeze", "file_path": "Provided_Code", "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": "Provided_Code", "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": "Provided_Code", "function_calls": [ { "function_call_name": "isinstance", "functionality": "Checks if an object is an instance of a class.", "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'.", "input": "m.weight.data", "output": "tensor", "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", "location_or_namespace": "torch.Tensor" } ] }, { "function_name": "LinearClassifier.forward", "file_path": "Provided_Code", "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" } ] } ]