Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Supress a model/nn.module #76

Open
ahmadmustafaanis opened this issue Jul 6, 2022 · 0 comments
Open

Supress a model/nn.module #76

ahmadmustafaanis opened this issue Jul 6, 2022 · 0 comments

Comments

@ahmadmustafaanis
Copy link

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant