Skip to content

Commit 1edba79

Browse files
committed
fixed div bug
1 parent 059aca8 commit 1edba79

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

keras_resnet/blocks/_1d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ def _shortcut(a, b):
110110
b_shape = keras.backend.int_shape(b)
111111

112112
if keras.backend.image_data_format() == "channels_last":
113-
x = int(round(a_shape[1] // b_shape[1]))
114-
y = int(round(a_shape[2] // b_shape[2]))
113+
x = int(round(a_shape[1] / b_shape[1]))
114+
y = int(round(a_shape[2] / b_shape[2]))
115115

116116
if x > 1 or y > 1 or not a_shape[3] == b_shape[3]:
117117
a = keras.layers.Conv2D(b_shape[3], (1, 1), strides=(x, y), padding="same", **parameters)(a)
118118

119119
a = keras.layers.BatchNormalization(axis=3)(a)
120120
else:
121-
x = int(round(a_shape[2] // b_shape[2]))
122-
y = int(round(a_shape[3] // b_shape[3]))
121+
x = int(round(a_shape[2] / b_shape[2]))
122+
y = int(round(a_shape[3] / b_shape[3]))
123123

124124
if x > 1 or y > 1 or not a_shape[1] == b_shape[1]:
125125
a = keras.layers.Conv2D(b_shape[1], (1, 1), strides=(x, y), padding="same", **parameters)(a)

keras_resnet/blocks/_2d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ def _shortcut(a, b):
110110
b_shape = keras.backend.int_shape(b)
111111

112112
if keras.backend.image_data_format() == "channels_last":
113-
x = int(round(a_shape[1] // b_shape[1]))
114-
y = int(round(a_shape[2] // b_shape[2]))
113+
x = int(round(a_shape[1] / b_shape[1]))
114+
y = int(round(a_shape[2] / b_shape[2]))
115115

116116
if x > 1 or y > 1 or not a_shape[3] == b_shape[3]:
117117
a = keras.layers.Conv2D(b_shape[3], (1, 1), strides=(x, y), padding="same", **parameters)(a)
118118

119119
a = keras.layers.BatchNormalization(axis=3)(a)
120120
else:
121-
x = int(round(a_shape[2] // b_shape[2]))
122-
y = int(round(a_shape[3] // b_shape[3]))
121+
x = int(round(a_shape[2] / b_shape[2]))
122+
y = int(round(a_shape[3] / b_shape[3]))
123123

124124
if x > 1 or y > 1 or not a_shape[1] == b_shape[1]:
125125
a = keras.layers.Conv2D(b_shape[1], (1, 1), strides=(x, y), padding="same", **parameters)(a)

keras_resnet/blocks/_3d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ def _shortcut(a, b):
110110
b_shape = keras.backend.int_shape(b)
111111

112112
if keras.backend.image_data_format() == "channels_last":
113-
x = int(round(a_shape[1] // b_shape[1]))
114-
y = int(round(a_shape[2] // b_shape[2]))
113+
x = int(round(a_shape[1] / b_shape[1]))
114+
y = int(round(a_shape[2] / b_shape[2]))
115115

116116
if x > 1 or y > 1 or not a_shape[3] == b_shape[3]:
117117
a = keras.layers.Conv3D(b_shape[3], (1, 1, 1), strides=(x, y), padding="same", **parameters)(a)
118118

119119
a = keras.layers.BatchNormalization(axis=3)(a)
120120
else:
121-
x = int(round(a_shape[2] // b_shape[2]))
122-
y = int(round(a_shape[3] // b_shape[3]))
121+
x = int(round(a_shape[2] / b_shape[2]))
122+
y = int(round(a_shape[3] / b_shape[3]))
123123

124124
if x > 1 or y > 1 or not a_shape[1] == b_shape[1]:
125125
a = keras.layers.Conv3D(b_shape[1], (1, 1, 1), strides=(x, y), padding="same", **parameters)(a)

keras_resnet/blocks/_time_distributed_2d.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,16 @@ def _shortcut(a, b):
110110
b_shape = keras.backend.int_shape(b)[1:]
111111

112112
if keras.backend.image_data_format() == "channels_last":
113-
x = int(round(a_shape[1] // b_shape[1]))
114-
y = int(round(a_shape[2] // b_shape[2]))
113+
x = int(round(a_shape[1] / b_shape[1]))
114+
y = int(round(a_shape[2] / b_shape[2]))
115115

116116
if x > 1 or y > 1 or not a_shape[3] == b_shape[3]:
117117
a = keras.layers.TimeDistributed(keras.layers.Conv2D(b_shape[3], (1, 1), strides=(x, y), padding="same", **parameters))(a)
118118

119119
a = keras.layers.TimeDistributed(keras.layers.BatchNormalization(axis=3))(a)
120120
else:
121-
x = int(round(a_shape[2] // b_shape[2]))
122-
y = int(round(a_shape[3] // b_shape[3]))
121+
x = int(round(a_shape[2] / b_shape[2]))
122+
y = int(round(a_shape[3] / b_shape[3]))
123123

124124
if x > 1 or y > 1 or not a_shape[1] == b_shape[1]:
125125
a = keras.layers.TimeDistributed(keras.layers.Conv2D(b_shape[1], (1, 1), strides=(x, y), padding="same", **parameters))(a)

0 commit comments

Comments
 (0)