new add
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 770 KiB |
@@ -0,0 +1,6 @@
|
|||||||
|
torch
|
||||||
|
torchvison
|
||||||
|
matplotlib
|
||||||
|
tqdm
|
||||||
|
numpy
|
||||||
|
fraction
|
||||||
+13
@@ -0,0 +1,13 @@
|
|||||||
|
import torch
|
||||||
|
import torch.nn as nn
|
||||||
|
|
||||||
|
|
||||||
|
def image_normalization(norm_type):
|
||||||
|
def _inner(tensor: torch.Tensor):
|
||||||
|
if norm_type == 'nomalization':
|
||||||
|
return tensor / 255.0
|
||||||
|
elif norm_type == 'denormalization':
|
||||||
|
return (tensor * 255.0).type(torch.FloatTensor)
|
||||||
|
else:
|
||||||
|
raise Exception('Unknown type of normalization')
|
||||||
|
return _inner
|
||||||
Reference in New Issue
Block a user