Create Kotlin library for both Android App and Desktop App

TLDR: I guess my question can be summarised to: Is there a way to create a pure Kotlin library with Torch as a dependency, that can be imported both from an Android App and a Desktop Kotlin/Java App?

I’ve created a Kotlin library for segmentation (let’s call it MySeg). It should use PyTorch as a dependency.
This MySegshould run on both an Android device, on on a pure Kotlin/Java Desktop application for test purposes.
I’ve added the PyTorch dependency but the compiler can find references to PyTorch.

This is what my build.gradle dependencies look like:

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation 'org.pytorch:pytorch_android:1.4.0'
    implementation 'org.pytorch:pytorch_android_torchvision:1.4.0'
    implementation project(path: ':opencv', configuration: 'default')

Is there any way I can create this MySeg library, with Torch as a dependency, so that MySeg can be imported both by an Android App and a pure Kotlin Desktop app?