Kotlin / kotlin-jupyter

Kotlin kernel for Jupyter/IPython
Apache License 2.0
1.1k stars 105 forks source link

Unresolved reference: tensorflow when importing tensorflow-lite #350

Closed quan-dang closed 2 years ago

quan-dang commented 2 years ago

Hi guys,

I'm trying to import tensorflow-lite using annotation and pom file (since there's no jar file), but it seems to have something wrong. Please help!

@file:Repository("https://repo1.maven.org/maven2")
@file:DependsOn("org.tensorflow:tensorflow-lite:pom:2.5.0")

import org.tensorflow.lite.*

The error is Unresolved reference: tensorflow

I tried to import another library, i.e. moneta, and it worked perfectly.

@file:DependsOn("org.javamoney:moneta:pom:1.3")
import org.javamoney.moneta.*
altavir commented 2 years ago

Tensorflow lite obviously does not have JVM artifact, only android artifacts (you can see all files here). You need to use full tensorflow.

quan-dang commented 2 years ago

Thanks, @altavir! 👍 I'm not familiar much with android. Could you pls show me how to install tensorflow lite on Kotlin jupyter notebook?

altavir commented 2 years ago

As far as I can understand, TensorFlow-lite, is developed specifically for Android, It could not be used on JVM and in the notebook. For the notebook, you should use TensorFlow-Java like the documentation. And if you want to use high level API, look at https://github.com/JetBrains/KotlinDL. It could be loaded via %use kotlin-dl.

quan-dang commented 2 years ago

Make sense! Thanks for your detailed guidance 😄