# JsonMappingException

**URL:** <https://community.konduit.ai/t/jsonmappingexception/1008>\
**Category:** ND4J\
**Created:** [November 23, 2020, 5:59pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008 "2020-11-23T17:59:04Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 3:00pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/21 "2020-12-03T15:00:27Z")

</div>

```
on linux:
download NDK
wget https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip
export ANDROID_NDK=/YOUR_NDK_FOLDER/
export ANDROID_VERSION=28
git clone https://github.com/eclipse/deeplearning4j.git
cd deeplearning4j
mvn -B -V -U clean install -pl '!jumpy,!pydatavec,!pydl4j' -Dlibnd4j.platform=android-arm64 -Djavacpp.platform=android-arm64 -Dmaven.test.skip=true

```

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 4:25pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/22 "2020-12-03T16:25:17Z")

</div>

@lavajaw  
btw, manually adding libc++\_shared.so worked for the android example. I was using 1.0.0-beta7. so I changed version to `def dl4jVersion = '1.0.0-beta7'`  
could you try it again in your project the below way?  
here how I did manual way for arm64:  
create folder ` src/main/jnilibs/{platform}`. for arm64 it will be` src/main/jnilibs/arm64-v8a/`  
then form ndk folder find the appropriate libc++\_shared.so (it should be inside sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++\_shared.so) and copy it to that folder  
build and package your apk again

P.S: I know you already tried it. but other than building manually its the fast alternative for now. So it is worth to retry

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 3, 2020, 4:33pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/23 "2020-12-03T16:33:24Z")

</div>

@quickwritereader yes, I tried with with solution you provided in last comment. And model is working,  
but output of that model is array of NaNs. I can send you example of model. Same code - same model is working on windows and linux. But on android device when I add libc++\_shared.so it returns array of NaN.

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 5:19pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/24 "2020-12-03T17:19:42Z")

</div>

I see. It could be also something related to blas function or precision. Have you tried it with double?

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 3, 2020, 5:28pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/25 "2020-12-03T17:28:25Z")

</div>

@quickwritereader no I can try it too. But it will slow-down model? I need to run it fast because it processing frames from camera in real time.

Just to have all information’s:  
I have models trained on beta5, beta6 and beta7. Models on beta5 and beta6 works on android fine (model trained on beta6 run on application with lib version beta6, etc…)

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 5:43pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/26 "2020-12-03T17:43:25Z")

</div>

I believe if it happens in the latest version ,too. we have to step-by step print it to see in which step it becomes nan

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 5:54pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/27 "2020-12-03T17:54:41Z")

</div>

you should somehow try the Openblas version from beta6 or the latest one to see if it works. check android-examples build gradle also

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 3, 2020, 6:13pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/28 "2020-12-03T18:13:46Z")

</div>

@quickwritereader I just executed model trained with DataType.DOUBLE and it has values, not NaNs.  
So beta7 have problem with FLOAT on android.

Also when i tried to make one train one model with HALF I got this:  
Caused by: org.nd4j.linalg.exception.ND4JIllegalStateException: Op [histogram] X argument uses leaked workspace pointer from workspace [WS\_LAYER\_WORKING\_MEM]: Workspace the array was defined in is no longer open.

And when i tried to train with BFLOAT16:  
IllegalStateException:Data type must be a floating point type: one of DOUBLE, FLOAT, or HALF. Got datatype: BFLOAT16

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 3, 2020, 6:15pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/29 "2020-12-03T18:15:46Z")

</div>

@quickwritereader Its bad solution to have only DOUBLE data type for android devices, I guess that is better to have INT or HALF, FLOAT… it can speed execution?

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 8:18pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/30 "2020-12-03T20:18:44Z")

</div>

yes, double was just for tests.  
there is a possibility that it is related to a third-party library, probably to the blas as you stated it was working on pc.

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 3, 2020, 8:35pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/31 "2020-12-03T20:35:13Z")

</div>

for speed and memory float type better than double. as for half its not widely supported for now. some used quantization successfully, too  
we are thinking of improving at least the inference side of our library using arm based libraries.

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 3, 2020, 9:21pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/32 "2020-12-03T21:21:18Z")

</div>

@quickwritereader first thank you for your help all day 🙂

So what I should expect in next period? My company has live product and we depend on dl4j.  
Do you expect new version of library soon with fixed this issue for android?  
Should I write topic somewhere so you can be aware of this problem?

@agibsonccc wrote me in section Feature Request that you are working on arm support and that are great news! I cant wait that support 🙂 With that, dl4j will open whole world.

---

<div class="post-metadata">

**Author:** ![agibsonccc](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/agibsonccc/32/697_2.png) [@agibsonccc](https://community.konduit.ai/u/agibsonccc)\
**Post date:** [December 3, 2020, 10:33pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/33 "2020-12-03T22:33:28Z")

</div>

> [@lavajaw](#):
>
> will open wh

@lavajaw yeah we have an active PR being worked by @quickwritereader that’s why I had him taking over this discussion 🙂 we’ll get there.

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 3, 2020, 10:37pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/34 "2020-12-03T22:37:22Z")

</div>

@agibsonccc @quickwritereader thanks, please notify me when something is ready. This is blocker for my application.

---

<div class="post-metadata">

**Author:** ![quickwritereader](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/quickwritereader/32/386_2.png) [@quickwritereader](https://community.konduit.ai/u/quickwritereader)\
**Post date:** [December 4, 2020, 9:34am UTC](https://community.konduit.ai/t/jsonmappingexception/1008/35 "2020-12-04T09:34:25Z")

</div>

if it is fine, could you provide us with minimal reproducible code or program and its model?  
thanks.

> I have a [Gmail.com](http://Gmail.com) account with my username

---

<div class="post-metadata">

**Author:** ![lavajaw](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/lavajaw/32/118_2.png) [@lavajaw](https://community.konduit.ai/u/lavajaw)\
**Post date:** [December 4, 2020, 12:45pm UTC](https://community.konduit.ai/t/jsonmappingexception/1008/36 "2020-12-04T12:45:50Z")

</div>

@quickwritereader i will send you in DM

[Previous page](https://community.konduit.ai/t/jsonmappingexception/1008.md?page=1)
