Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

Commit

Permalink
Added notes and checks of the new limitation that if ICNR is used the…
Browse files Browse the repository at this point in the history
…n the upsample factor must be an integer
  • Loading branch information
danieltudosiu committed Oct 24, 2019
1 parent ee2379c commit 72437a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions niftynet/layer/subpixel.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ class SubPixelLayer(TrainableLayer):
SubPixel Convolution initialised with ICNR initialisation
and followed by an AveragePooling
Limitations:
If ICNR initialization is used then the upsample factor
MUST be an integer
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Shi, W., Caballero, J., Huszár, F., Totz, J., Aitken, A.P.,
Bishop, R., Rueckert, D. and Wang, Z., 2016.
Expand Down Expand Up @@ -88,6 +93,8 @@ def __init__(

if upsample_factor <= 0:
raise ValueError("The upsampling factor must be strictly positive.")
if int(upsample_factor)!=float(upsample_factor) and use_icnr:
raise ValueError("If ICNR initialization is used the sample factor must be an integer")

self.upsample_factor = upsample_factor
self.kernel_size = kernel_size
Expand Down

0 comments on commit 72437a2

Please sign in to comment.