def resnet_block(input_channels, num_channels, num_residuals, first_block=False):
blk = []
for i in range(num_residuals):
if i == 0 and not first_block:
blk.append(Residual(input_channels, num_channels, use_1x1conv=True, strides=2))
else:
blk.append(Residual(num_channels, num_channels))
return blk
I tried running the code in colab but there was a channel error. so I added the last line of code
in_channels = out_channels
And the new code looks like this .and it runs ok.
def resnet_block(in_channels,out_channels,num_residuals,first_block = False):
blk = []
for i in range(num_residuals):
if i == 0 or not first_block:
blk.append(Residual(in_channels,out_channels,use_1x1conv= True,strides = 2))
else:
blk.append(Residual(out_channels,out_channels))
in_channels = out_channels
return blk
This is the original code
I tried running the code in colab but there was a channel error. so I added the last line of code
And the new code looks like this .and it runs ok.