Skip to content

Commit

Permalink
fix reshape issue with inferred dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
chentaMS committed Jun 7, 2017
1 parent 1eca798 commit 82832a3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions keras/backend/cntk_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,11 +639,17 @@ def _reshape_dummy_dim(x, axis):

_axis = [_ + len(shape) if _ < 0 else _ for _ in axis]

for index in sorted(_axis, reverse=True):
del shape[index]
if shape.count(C.InferredDimension) > 1:
result = x
for index in sorted(_axis, reverse=True):
result = C.reshape(result, shape=(), begin_axis=index, end_axis=index + 1)
return result
else:
for index in sorted(_axis, reverse=True):
del shape[index]

shape = tuple(shape)
return C.reshape(x, shape)
shape = tuple(shape)
return C.reshape(x, shape)


def mean(x, axis=None, keepdims=False):
Expand Down

0 comments on commit 82832a3

Please sign in to comment.