Skip to content

Commit 76cfea2

Browse files
michalharakalclaude
andcommitted
Rename TensorSpecEncoding.kt class for Java callers (#400)
Adds `@file:JvmName("TensorSpecs")` to `skainet-lang-core/.../tensor/ops/TensorSpecEncoding.kt`. The file declares three top-level extension functions used to read and write the `TensorEncoding` metadata that #469 plumbed onto `TensorSpec`: `tensorEncoding`, `withTensorEncoding`, and `inferTensorEncoding`. Top-level extensions in Kotlin compile to static methods on a synthetic class named after the source file — by default `TensorSpecEncodingKt`. Java call sites ended up looking like: TensorEncoding encoding = TensorSpecEncodingKt.getTensorEncoding(spec); TensorSpec annotated = TensorSpecEncodingKt.withTensorEncoding(spec, TensorEncoding.Q8_0.INSTANCE); TensorEncoding data = TensorSpecEncodingKt.inferTensorEncoding(tensorData); With `@file:JvmName("TensorSpecs")` they become: TensorEncoding encoding = TensorSpecs.getTensorEncoding(spec); TensorSpec annotated = TensorSpecs.withTensorEncoding(spec, TensorEncoding.Q8_0.INSTANCE); TensorEncoding data = TensorSpecs.inferTensorEncoding(tensorData); Same Kotlin call sites are unaffected (they see the top-level extension syntax either way) — `spec.tensorEncoding` and `spec.withTensorEncoding(TensorEncoding.Q8_0)` still work unchanged. Pure JVM-side binary name change. Verified with jvmTest, compileKotlinWasmJs, macosArm64Test on skainet-lang-core — no regressions. Fourth of five commits polishing the Java / JVM consumption story for the upcoming 0.19.0 release. See #400. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1ebd21b commit 76cfea2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/ops/TensorSpecEncoding.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
@file:JvmName("TensorSpecs")
2+
13
package sk.ainet.lang.tensor.ops
24

35
import sk.ainet.lang.tensor.data.TensorData
46
import sk.ainet.lang.tensor.storage.PackedBlockStorage
57
import sk.ainet.lang.tensor.storage.TensorEncoding
8+
import kotlin.jvm.JvmName
69

710
/**
811
* Metadata key used to carry a [TensorEncoding] on a [TensorSpec].

0 commit comments

Comments
 (0)