File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
sbi/neural_nets/embedding_nets Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ def __init__(
127
127
cnn_output_size = input_shape
128
128
stride = 1
129
129
padding = 1
130
+
130
131
for ii in range (num_conv_layers ):
131
132
# Defining another 2D convolution layer
132
133
conv_layer = conv_module (
@@ -141,6 +142,12 @@ def __init__(
141
142
# Calculate change of output size of each CNN layer
142
143
cnn_output_size = get_new_cnn_output_size (cnn_output_size , conv_layer , pool )
143
144
145
+ assert all (
146
+ cnn_output_size
147
+ ), f"""CNN output size is zero at layer { ii + 1 } . Either reduce
148
+ num_cnn_layers to { ii } or adjust the kernel_size
149
+ and pool_kernel_size accordingly."""
150
+
144
151
self .cnn_subnet = nn .Sequential (* cnn_layers )
145
152
146
153
# Construct linear post processing net.
You can’t perform that action at this time.
0 commit comments