From d08c159aee4b580800893e983e84b972498dd28e Mon Sep 17 00:00:00 2001 From: jeanfad Date: Mon, 30 May 2016 21:49:59 +0200 Subject: [PATCH] adapt input_numpy to row major --- contrib/Python/cntk/ops/__init__.py | 2 ++ contrib/Python/cntk/utils/__init__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/Python/cntk/ops/__init__.py b/contrib/Python/cntk/ops/__init__.py index e37afdba0..16392ad4e 100644 --- a/contrib/Python/cntk/ops/__init__.py +++ b/contrib/Python/cntk/ops/__init__.py @@ -959,6 +959,8 @@ def input_numpy(value, alias=None, dynamic_axis='', name=None): if len(cntk_shape) == 0: raise ValueError('value should be an array of input samples') + # cntk uses column major, thus we reverse the shape + cntk_shape = tuple(reversed(cntk_shape)) node = input(cntk_shape, dynamic_axis=dynamic_axis, name=name) from ..reader import LazyInputReader node.reader = LazyInputReader( diff --git a/contrib/Python/cntk/utils/__init__.py b/contrib/Python/cntk/utils/__init__.py index 8ba92f8d2..8479a6925 100644 --- a/contrib/Python/cntk/utils/__init__.py +++ b/contrib/Python/cntk/utils/__init__.py @@ -104,7 +104,7 @@ def with_metaclass(meta, *bases): def dense_to_str(data): - return ' '.join(data.ravel(order='F').astype(np.str)) + return ' '.join(data.ravel(order='C').astype(np.str)) def sparse_to_str(data):