# Element must be a scalar

**URL:** <https://community.konduit.ai/t/element-must-be-a-scalar/573>\
**Category:** DL4J\
**Created:** [May 31, 2020, 6:29pm UTC](https://community.konduit.ai/t/element-must-be-a-scalar/573 "2020-05-31T18:29:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:27am UTC](https://community.konduit.ai/t/element-must-be-a-scalar/573/2 "2020-06-01T08:27:03Z")

</div>

I guess the error comes from the line

```auto
    INDArray image = img.put(1,img);

```

And you are doing it because you had an error similar to [Wrong input size - expected matrix - #3 by will-maclean](https://community.konduit.ai/t/wrong-input-size-expected-matrix/566/3)?

Use `asMatrix` instead of `asRowVector` and skip this `put` thing entirely.

---

_[View the full topic](https://community.konduit.ai/t/element-must-be-a-scalar/573)._
