- from torch import nn
- import torch
- import os
- os.environ['CUDA_VISIBLE_DEVICES']='1'
-
- class CharbonnierLoss(nn.Module):
- """L1 Charbonnierloss."""
- def __init__(self):
- super(CharbonnierLoss, self).__init__()
- self.eps = 1e-6
-
- def forward(self, X, Y):
- diff = torch.add(X, -Y)
- error = torch.sqrt(diff * diff + self.eps)
- # print(error)
- loss = torch.sum(error)
- return loss
- class Conv_ReLU_Block(nn.Module):
- def __init__(self,in_channels=64,out_channels=64,kernel_size=3,dilation=1):
- super(Conv_ReLU_Block, self).__init__()
- self.conv = nn.Conv2d(in_channels=in_channels, out_channels=out_channel