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