Skip to content

[Lane 2 · kotlin-core] TransposedConv2d — CPU kernel for convTranspose2d #1373

Open

Description

@michalharakal

Sub-issue of #1371 ([Feature]: TransposedConv2d — convTranspose2d op, CPU kernel, backward and StableHLO lowering).

Lane: 2 · Kotlin core
Skill needed: Kotlin; comfortable reading nested-loop tensor kernels. No autodiff or compiler knowledge needed.
Size: m (1–2 days)
Blocked by: nothing

What to do

  1. Override convTranspose2d in DefaultCpuOps (skainet-backends/skainet-backend-cpu/src/commonMain/kotlin/sk/ainet/exec/tensor/ops/DefaultCpuOps.kt). Copy the structure of convTranspose1d in the same file and add the second spatial axis; take shape validation, bias handling and group indexing from conv2d.
  2. Put @NotImplemented on nothing new — instead remove @NotImplemented from TensorOps.convTranspose2d (skainet-lang/skainet-lang-core/src/commonMain/kotlin/sk/ainet/lang/tensor/ops/TensorOps.kt) and from the TransposedConv2d class, and drop the now-stale comment in TransposedConv2d.forward.
  3. Add tests in skainet-backends/skainet-backend-cpu/src/commonTest using the Lane-1 cases (or hand-computed tiny cases if Lane 1 is not done yet), plus a TransposedConv2d.forward test in lang-core next to AdvancedConvolutionsTest.
  4. Run ./gradlew :skainet-backends:skainet-backend-cpu:jvmTest :skainet-lang:skainet-lang-core:jvmTest checkUnmarkedStubs, then regenerate the matrix: ./gradlew :skainet-compile:skainet-compile-hlo:jvmTest --tests '*HloCoverageDumpTest' :skainet-compile:skainet-compile-dag:jvmTest --tests '*BackwardCoverageDumpTest' generateDocs and commit the changed docs/modules/ROOT/pages/reference/ files.

Acceptance

  • TransposedConv2d.forward returns PyTorch-matching output on CPU
  • Matrix shows ✅ in the cpu column for convTranspose2d and ✅ for TransposedConv2d in the NN-layers table
  • apiCheck passes (run apiDump if the override changes the dump)
  • Result reported back on the parent issue

Notes

Non-FP32 dtypes: follow whatever conv2d does for dtype dispatch; do not copy the as Float casts blindly. If that turns out to be a bigger job, ship FP32 and open a follow-up.

Coverage matrix: docs/modules/ROOT/pages/reference/ops-status-matrix.adoc · How lanes work: Issue taxonomy

Metadata

Metadata

Assignees

No one assigned

    Labels

    codingImplementation task (DARC: C)size:m1-2 daysskill:kotlin-coreKotlin implementation in commonMainsub-issueSub-issue of a tracking issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions