From 5e0f3d78e08676ea56724a0aec6dbeb1e6d02990 Mon Sep 17 00:00:00 2001 From: frankseide Date: Fri, 6 May 2016 17:20:51 -0700 Subject: [PATCH] bug fix: TensorView::AsMatrix() must determine needsReshaping correctly if needsSlicing --- Source/Math/TensorView.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Math/TensorView.cpp b/Source/Math/TensorView.cpp index 4d5552b8a0a1..b02204808236 100644 --- a/Source/Math/TensorView.cpp +++ b/Source/Math/TensorView.cpp @@ -363,7 +363,7 @@ shared_ptr> TensorView::AsMatrix() const // which gets reinterpreted back as a [K x J x S x T] tensor // In the special case of sparse matrices, this split cannot be done. E.g. in the above example, we could only multiply with a [K x I x J] tensor. let needsSlicing = firstColumn != 0 || numColumns != m_sob->GetNumCols(); - let needsReshaping = m_shape[0] != m_sob->GetNumRows() || m_shape[1] != m_sob->GetNumCols(); + let needsReshaping = m_shape[0] != m_sob->GetNumRows() || m_shape[1] != numColumns; // Note: If an output matrix is a view and needs to move to a different device, we will fail later, since the current structure cannot support that. // As a consequence, some configurations will simply not work currently.