[quote=“Harsimar_Singh, post:1, topic:84215”]
So I did this first which resulted in error -
import fastai
from torchsummary import summary
from fastai.vision.models.unet import *
from fastai.callbacks import *
from fastai.utils.mem import *

arch = torchvision.models.resnet34(pretrained=False)

li = list(model.children()) #list of the children

print( li[0][0][0] ) -> gives Conv2d(3, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)

So I do is li[0][0][0] = nn.Conv2d(1, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)

So here my input will be one channel which I want as the input to the resnet.

summary(model.to(‘cuda’),input_size=(1, 320, 320)) -> Here I have this error which is NotImplemented Error

After your suggestions I did this
def build_model(args):
    arch = torchvision.models.resnet34(pretrained=False)
    arch.conv1 = nn.Conv2d(1, 64, kernel_size=(7, 7), stride=(2, 2), padding=(3, 3), bias=False)
    li = list(arch.children())
    arch = nn.Sequential(*li[:8])
    model = DynamicUnet(encoder=arch,n_classes = 1,img_size = (320,320)) #fastai unet converter class using a pertained network as encoder 
    model.to(args.device)
    return model

And this worked beautifully !! Thank you so much