Skip to content

Supress a model/nn.module #76

@ahmadmustafaanis

Description

@ahmadmustafaanis

I want to ask, if there is any way to suppress a model.
i.e
My model is

class SiameseNetwork(nn.Module):
    def __init__(self):
        super(SiameseNetwork, self).__init__()
        # Setting up the Sequential of CNN Layers
        self.model1 = models.resnet50(pretrained=True)
        # Defining the fully connected layers
        self.fc1 = nn.Sequential(            
            nn.Linear(1000,2))
        
    def forward_once(self, x):
        # Forward pass 
        output = self.model1(x)

        print(self.model1.fc.in_features)

        output = self.fc1(output)
        return output

    def forward(self, input1, input2):
        # forward pass of input 1
        output1 = self.forward_once(input1)
        # forward pass of input 2
        output2 = self.forward_once(input2)
        return output1, output2

This shows complete ResNet50. Which I do not want. Instead I want a small block saying ResNet50. how can I do this,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions