How can I import my CNN-model in another code?
This is my &quot;model&quot;, I just added a piece of it here for understanding purpose. I want this model to be imported in another piece of code named as &quot;trainer&quot;.
import torch.nn as nn
import torch

class Signet(nn.Module):
    def __init__(self, num_users=10):
        super(Signet, self).__init__()
        self.num_classes = num_users
        self.forward_util_layer = {}



This is another piece of code. Here &quot;Model&quot; is what I want to import like I mentioned above.
import model

class Trainer:
    def __init__(self, trainData, testData, num_users=10):
        self.trainData = trainData
        self.testData = testData


What are the ways to import it. Where to save my model.ipynb, so that my trainer.ipynb can import it. Or if there is any way to call it directly in my trainer.ipynb code?

Move your model code to model.py file. Keep that file in the same directory as your trainer.ipynb
Now, to load the model in the ipynb file, follow these steps.
import sys  
sys.path.insert(0, '/path/to/model/folder')
from model import Signet
m = Signet(15)

