# Issue in getting 2d DataSet

**URL:** <https://community.konduit.ai/t/issue-in-getting-2d-dataset/571>\
**Category:** DL4J\
**Created:** [May 31, 2020, 4:04pm UTC](https://community.konduit.ai/t/issue-in-getting-2d-dataset/571 "2020-05-31T16:04:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spark](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/spark/32/84_2.png) [@Spark](https://community.konduit.ai/u/Spark)\
**Post date:** [May 31, 2020, 4:04pm UTC](https://community.konduit.ai/t/issue-in-getting-2d-dataset/571/1 "2020-05-31T16:04:42Z")

</div>

Hi Team

While following a basic autoencoder tutorial([https://deeplearning4j.konduit.ai/getting-started/tutorials/basic-autoencoder](https://deeplearning4j.konduit.ai/getting-started/tutorials/basic-autoencoder)), I am getting issue while evaluating score for testing sample at:

`// testSample.getRow(j) - Vector of shape [1x784], used as input and target`  
`model.score(new DataSet(testSample.getRow(j), testSample.getRow(j)))`

Exception:  
`Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidInputException: Input that is not a matrix; expected matrix (rank 2), got rank 1 array with shape [784]. Missing preprocessor or wrong input type? (layer name: layer0, layer index: 0, layer type: DenseLayer)`

Please let me know if the whole code is required.  
Please help!

Thanks & Regards

---

<div class="post-metadata">

**Author:** ![will-maclean](https://avatars.discourse-cdn.com/v4/letter/w/94ad74/32.png) [@will-maclean](https://community.konduit.ai/u/will-maclean)\
**Post date:** [June 1, 2020, 1:07am UTC](https://community.konduit.ai/t/issue-in-getting-2d-dataset/571/2 "2020-06-01T01:07:16Z")

</div>

Think I can help with that as I had the identical error recently. DL4J expects the first dimension of your input to be batch size, so I think you need to transpose your input vector.

---

<div class="post-metadata">

**Author:** ![treo](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/treo/32/47_2.png) [@treo](https://community.konduit.ai/u/treo)\
**Post date:** [June 1, 2020, 8:13am UTC](https://community.konduit.ai/t/issue-in-getting-2d-dataset/571/3 "2020-06-01T08:13:20Z")

</div>

Thank you for telling us about that bug in the Tutorials. Unfortunately, the tutorials are a bit out of date at the moment - so stumbling stones like this are going to happen every once in a while. I’ve updated the code in the tutorial to behave as needed at that point.

`getRow` now returns a simple vector, instead of a [1,n] matrix. But as the model always expects a matrix with the first dimension being the batch size, as @will-maclean has already noted, we need to get the old behavior in this case.

To get a matrix instead of a vector, you have to tell getRow to keep the leading dimension:

```java
testSample.getRow(j, true)

```

---

<div class="post-metadata">

**Author:** ![Spark](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/spark/32/84_2.png) [@Spark](https://community.konduit.ai/u/Spark)\
**Post date:** [June 15, 2020, 3:21pm UTC](https://community.konduit.ai/t/issue-in-getting-2d-dataset/571/4 "2020-06-15T15:21:27Z")

</div>

Hi @will-maclean and @treo,

Sorry for the late response, got busy last few weeks.

Thanks for clarifying the DL4J behaviour. And yes, that fixed the issue.  
Also, unless helping persons like @treo are here, no one has to worry about the stumbling stones.

Thanks again!
