@@ -12,13 +12,15 @@ import spire.math.Numeric
12
12
import spire .implicits ._
13
13
import spire .algebra .Field
14
14
import org .emergentorder .onnx .Tensors ._
15
+ // import scala.compiletime.ops.int //For RC2
15
16
import scala .compiletime .ops .int ._
16
17
import io .kjaer .compiletime ._
17
18
import io .kjaer .compiletime .Shape .NumElements
18
19
import org .emergentorder .compiletime ._
19
20
import org .emergentorder .compiletime .TensorShapeDenotation .Reverse
20
21
package object onnx {
21
22
23
+ // TODO: Symbolic shape values
22
24
// TODO: Support bfloat16 type (new in ONNX 1.8.0)
23
25
// TODO: Fix propagation behavavior for TensorShapeDenotation
24
26
// TODO: Encode node names as types
@@ -3234,9 +3236,6 @@ package object onnx {
3234
3236
}
3235
3237
}
3236
3238
3237
- // TODO: Constraint for shape denotation
3238
- //
3239
- // + match types on axes
3240
3239
trait ReshapeV5 extends Operator {
3241
3240
def ReshapeV5 [
3242
3241
@ sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double | String | Boolean | Complex [
@@ -4041,13 +4040,14 @@ package object onnx {
4041
4040
}
4042
4041
4043
4042
// Missing V13
4044
- // TODO: Constraint
4043
+ // TODO: Constraint on range, and for V1, disallow negative indexing
4045
4044
trait SqueezeV11 extends Operator {
4046
4045
def SqueezeV11 [
4047
4046
@ sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double | String | Boolean | Complex [
4048
4047
Float
4049
4048
] | Complex [Double ]
4050
- , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Td1 <: TensorShapeDenotation , S1 <: Shape ](name : String , axes : Option [(Array [Int ])] = None , data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [Td1 ], s : ShapeOf [S1 ]): Tensor [T , Tuple3 [Tt1 ,Td1 ,S1 ]] = {
4049
+ , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Axis <: Indices ](name : String , axes : Option [(Axis )] = None , data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [KeepOrReduceDimDenotations [Td ,Axis ,false ]], s : ShapeOf [KeepOrReduceDims [S ,Axis ,false ]], i : IndicesOf [Axis ]): Tensor [T , Tuple3 [Tt1 ,KeepOrReduceDimDenotations [Td ,Axis ,false ],KeepOrReduceDims [S ,Axis ,false ]]] = {
4050
+ val axes = indicesOf[Axis ].indices.toArray
4051
4051
val map : Map [String , Any ] = Map (" axes" -> axes)
4052
4052
val allInputs = Tuple1 (data)
4053
4053
(callOp(name, " Squeeze" , allInputs, map))
@@ -4059,7 +4059,8 @@ package object onnx {
4059
4059
@ sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double | String | Boolean | Complex [
4060
4060
Float
4061
4061
] | Complex [Double ]: Numeric
4062
- , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Td1 <: TensorShapeDenotation , S1 <: Shape ](name : String , axes : Option [(Array [Int ])] = None , data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [Td1 ], s : ShapeOf [S1 ]): Tensor [T , Tuple3 [Tt1 ,Td1 ,S1 ]] = {
4062
+ , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Axis <: Indices ](name : String , axes : Option [(Axis )] = None , data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [KeepOrReduceDimDenotations [Td ,Axis ,false ]], s : ShapeOf [KeepOrReduceDims [S ,Axis ,false ]], i : IndicesOf [Axis ]): Tensor [T , Tuple3 [Tt1 ,KeepOrReduceDimDenotations [Td ,Axis ,false ],KeepOrReduceDims [S ,Axis ,false ]]] = {
4063
+ val axes = indicesOf[Axis ].indices.toArray
4063
4064
val map : Map [String , Any ] = Map (" axes" -> axes)
4064
4065
val allInputs = Tuple1 (data)
4065
4066
(callOp(name, " Squeeze" , allInputs, map))
@@ -4399,13 +4400,14 @@ package object onnx {
4399
4400
}
4400
4401
*/
4401
4402
// Missing V13
4402
- // TODO: Constraint
4403
+ // TODO: Constraint on range, and for V1, disallowing negative indexes
4403
4404
trait UnsqueezeV11 extends Operator {
4404
4405
def UnsqueezeV11 [
4405
4406
@ sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double | String | Boolean | Complex [
4406
4407
Float
4407
4408
] | Complex [Double ]: Numeric
4408
- , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Td1 <: TensorShapeDenotation , S1 <: Shape ](name : String , axes : (Array [Int ]), data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [Td1 ], s : ShapeOf [S1 ]): Tensor [T , Tuple3 [Tt1 ,Td1 ,S1 ]] = {
4409
+ , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Axis <: Indices ](name : String , axes : Option [(Axis )] = None , data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [KeepOrReduceDimDenotations [Td ,Axis ,false ]], s : ShapeOf [KeepOrReduceDims [S ,Axis ,false ]], i : IndicesOf [Axis ]): Tensor [T , Tuple3 [Tt1 ,KeepOrReduceDimDenotations [Td ,Axis ,false ],KeepOrReduceDims [S ,Axis ,false ]]] = {
4410
+ val axes = indicesOf[Axis ].indices.toArray
4409
4411
val map : Map [String , Any ] = Map (" axes" -> axes)
4410
4412
val allInputs = Tuple1 (data)
4411
4413
(callOp(name, " Unsqueeze" , allInputs, map))
@@ -4417,7 +4419,8 @@ package object onnx {
4417
4419
@ sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double | String | Boolean | Complex [
4418
4420
Float
4419
4421
] | Complex [Double ]: Numeric
4420
- , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Td1 <: TensorShapeDenotation , S1 <: Shape ](name : String , axes : (Array [Int ]), data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [Td1 ], s : ShapeOf [S1 ]): Tensor [T , Tuple3 [Tt1 ,Td1 ,S1 ]] = {
4422
+ , Tt <: TensorTypeDenotation , Td <: TensorShapeDenotation , S <: Shape , Tt1 <: TensorTypeDenotation , Axis <: Indices ](name : String , axes : Option [(Axis )] = None , data : Tensor [T , Tuple3 [Tt ,Td ,S ]])(using tt : ValueOf [Tt1 ], td : TensorShapeDenotationOf [KeepOrReduceDimDenotations [Td ,Axis ,false ]], s : ShapeOf [KeepOrReduceDims [S ,Axis ,false ]], i : IndicesOf [Axis ]): Tensor [T , Tuple3 [Tt1 ,KeepOrReduceDimDenotations [Td ,Axis ,false ],KeepOrReduceDims [S ,Axis ,false ]]] = {
4423
+ val axes = indicesOf[Axis ].indices.toArray
4421
4424
val map : Map [String , Any ] = Map (" axes" -> axes)
4422
4425
val allInputs = Tuple1 (data)
4423
4426
(callOp(name, " Unsqueeze" , allInputs, map))
0 commit comments