Whether you want to add Kotlin DL to your project or experiment with it in a Jupyter Notebook, first you'll need to set up the appropriate dependencies.
- Open a Kotlin project where you want to use Kotlin DL, or create a new Kotlin project in IntelliJ IDEA as described in the Kotlin documentation.
- Add the Kotlin DL dependency to your project's build file.
- If you're using Gradle as the build system, add the following to the
build.gradle
file:
repositories { mavenCentral() } dependencies { implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-api:[KOTLIN-DL-VERSION]' }
- For
build.gradle.kts
:
repositories { mavenCentral() } dependencies { implementation ("org.jetbrains.kotlinx:kotlin-deeplearning-api:[KOTLIN-DL-VERSION]") }
- If your project is built with Maven, add Kotlin DL to your
pom.xml
:
<dependency> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlin-deeplearning-api</artifactId> <version>[KOTLIN-DL-VERSION]</version> <type>pom</type> </dependency>
- If you're using Gradle as the build system, add the following to the
You can use the Kotlin DL functionality in any existing Java project, even if you don’t have any other Kotlin code in it yet. Check out these instructions on how to add Kotlin code to your existing Java codebase.
That's it! Now you're ready to build your first neural network.
- Open an Android project where you want to use Kotlin DL, or create a new Android project in Android Studio as described in the Android documentation.
- Add the Kotlin DL dependency to your project's build files.
- Add the following to the top-level
build.gradle
file:
repositories { mavenCentral() }
- Add the following to the
build.gradle
file in the application module:
dependencies { implementation 'org.jetbrains.kotlinx:kotlin-deeplearning-onnx:[KOTLIN-DL-VERSION]' }
- Add the following to the top-level
- Please check out the Documentation and Sample Android App for more details.
If you want to experiment with Kotlin DL, and use it interactively, you can choose to work with it in a Jupyter Notebook. In this case, you will need to install Jupyter, add the Kotlin kernel, and set up the Kotlin DL dependency in the notebook. Here are step-by-step instructions to help you get started:
-
To set up Jupyter Notebook, you need to first have Python installed on your machine.
-
The next step is to install the Anaconda distribution that includes Jupyter Notebook.
-
For the Kotlin kernel to work, make sure you have Java v.8 or later installed.
-
Once installed, add the Kotlin Kernel to Jupyter Notebook with the following command:
conda install -c jetbrains kotlin-jupyter-kernel
-
Start your Jupyter Notebook from the command line using
jupyter notebook
-
Once Jupyter Notebook is open in your browser, you can create a new Kotlin notebook from the UI.
-
In your new Kotlin notebook, add a dependency for Kotlin DL:
@file:DependsOn("org.jetbrains.kotlinx:kotlin-deeplearning-api:[KOTLIN-DL-VERSION]")
You are now all set! Next, you can start building your first neural network.