Skip to content

Commit 52be2a2

Browse files
committed
Add depth dim
1 parent ce4e0e9 commit 52be2a2

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

python/paddle/trainer/config_parser.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3865,9 +3865,18 @@ def __init__(self, name, inputs, reshape, **xargs):
38653865
else:
38663866
inH = input_layer.height
38673867
inW = input_layer.width
3868-
inC = input_layer.size / inH / inW
3869-
out_dims = [0, inH, inW, inC]
3870-
size = reduce(lambda x, y: x * y, out_dims[reshape['width'][0]:])
3868+
if input_layer.has_depth():
3869+
inD = input_layer.depth
3870+
inC = input_layer.size / inH / inW / inD
3871+
out_dims = [0, inD, inH, inW, inC]
3872+
size = reduce(lambda x, y: x * y,
3873+
out_dims[reshape['width'][0]:])
3874+
else:
3875+
inC = input_layer.size / inH / inW
3876+
out_dims = [0, inH, inW, inC]
3877+
size = reduce(lambda x, y: x * y,
3878+
out_dims[reshape['width'][0]:])
3879+
38713880
self.set_layer_size(size)
38723881

38733882

0 commit comments

Comments
 (0)