|
| 1 | +import scala.compiletime.ops.string.+ |
| 2 | +import scala.compiletime.ops.int |
| 3 | +import scala.compiletime.ops.int.{S, +, <, <=, *} |
| 4 | +import scala.compiletime.ops.boolean.&& |
| 5 | + |
| 6 | +object OnnxMin { |
| 7 | + type Index = Int & Singleton |
| 8 | + |
| 9 | + sealed trait Indices |
| 10 | + final case class :::[+H <: Index, +T <: Indices](head: H, tail: T) extends Indices |
| 11 | + |
| 12 | + sealed trait INil extends Indices |
| 13 | + case object INil extends INil |
| 14 | + |
| 15 | + |
| 16 | + type Dimension = Int & Singleton |
| 17 | + |
| 18 | + sealed trait Shape extends Product with Serializable |
| 19 | + |
| 20 | + final case class #:[+H <: Dimension, +T <: Shape](head: H, tail: T) extends Shape |
| 21 | + |
| 22 | + sealed trait SNil extends Shape |
| 23 | + case object SNil extends SNil |
| 24 | + |
| 25 | + type CContains[Haystack <: Indices, Needle <: Index] <: Boolean = Haystack match { |
| 26 | + case head ::: tail => head match { |
| 27 | + case Needle => true |
| 28 | + case _ => CContains[tail, Needle] |
| 29 | + } |
| 30 | + case INil => false |
| 31 | + } |
| 32 | + |
| 33 | + type AddGivenAxisSizeLoop[First <: Shape, Second <: Shape, AxisIndex <: Indices, I <: Index] <: Shape = First match { |
| 34 | + case head #: tail => CContains[AxisIndex, I] match { |
| 35 | + case true => Second match { |
| 36 | + case secondHead #: secondTail => head #: tail |
| 37 | + case SNil => AxisIndex match{ |
| 38 | + case INil => SNil |
| 39 | + } |
| 40 | + } |
| 41 | + } |
| 42 | + } |
| 43 | + |
| 44 | + def ConcatV13: AddGivenAxisSizeLoop[Dimension #: Shape, Dimension #: Shape, Index ::: INil, 0] = ??? |
| 45 | +} |
0 commit comments