# Issue with nextAction(Observation observation) on beta7

**URL:** <https://community.konduit.ai/t/issue-with-nextaction-observation-observation-on-beta7/577>\
**Category:** RL4J\
**Created:** [June 3, 2020, 2:39am UTC](https://community.konduit.ai/t/issue-with-nextaction-observation-observation-on-beta7/577 "2020-06-03T02:39:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GaboGoyx](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@GaboGoyx](https://community.konduit.ai/u/GaboGoyx)\
**Post date:** [June 3, 2020, 2:39am UTC](https://community.konduit.ai/t/issue-with-nextaction-observation-observation-on-beta7/577/1 "2020-06-03T02:39:29Z")

</div>

Hi, I’m having trouble with nextAction(…) from DQNPolicy on 1.0.0-beta7.  
I build an observation from a double array \> new Observation(Nd4j.create(states)) where states is double of length 19.  
There is no problem while training (I use it in the MDP implementation), but the following error arises when when the same observation is used in policy.nextAction(observation):  
“Input that is not a matrix; expected matrix (rank 2), got rank 1 array with shape [19]. Missing preprocessor or wrong input type? (layer name: layer0, layer index: 0, layer type: DenseLayer)”

---

<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 3, 2020, 8:22am UTC](https://community.konduit.ai/t/issue-with-nextaction-observation-observation-on-beta7/577/2 "2020-06-03T08:22:03Z")

</div>

I guess that is a bit of an unintended consequence that models always expect to be given batches, even if in the context of reinforcement learning it doesn’t make quite as much sense.

But you can fix this problem easily by replacing `policy.nextAction(observation)` with `policy.nextAction(Nd4j.expandDims(observation, 0))`.

---

<div class="post-metadata">

**Author:** ![GaboGoyx](https://avatars.discourse-cdn.com/v4/letter/g/58f4c7/32.png) [@GaboGoyx](https://community.konduit.ai/u/GaboGoyx)\
**Post date:** [June 3, 2020, 2:11pm UTC](https://community.konduit.ai/t/issue-with-nextaction-observation-observation-on-beta7/577/3 "2020-06-03T14:11:12Z")

</div>

Thanks Paul for the reply.  
This worked but I had to adjust it a bit since I’m using “observation” as an instance of class Observation, so I applied policy.nextAction(Nd4j.expandDims(observation.getData(), 0)).
