Commit 76cfea2
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
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
| |||
0 commit comments