Skip to content

Commit 0a0bb02

Browse files
committed
Add Clip V12 op
1 parent fa75ed5 commit 0a0bb02

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

backends/.jvm/src/main/scala/ORTOperatorBackendAll.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class ORTOperatorBackendAll
3434
with CeluV12 //new in 1.7.0
3535
with ClipV6
3636
// with ClipV11 //not supported in ONNX.js
37+
with ClipV12
3738
// with CompressV11
3839
with ConcatV11
3940
// with ConcatFromSequenceV11

core/src/main/scala/ONNX.scala

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,23 +1293,23 @@ package object onnxruntime {
12931293
(callOp(name, "BitShift", allInputs, map))
12941294
}
12951295
}
1296-
//Not supported, not in ONNXJS
1297-
/*
1298-
trait ClipV12 extends Operator {
1296+
1297+
//Diverging from the spec, min and max are optional there, but otherwise it's a no-op
1298+
trait ClipV12 extends onnx.Operator {
12991299
def ClipV12[
1300-
@sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double: Numeric
1301-
, Ax <: Axes, Tt <: TensorTypeDenotation, Dd <: DimensionDenotation](
1300+
@sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | onnx.Float16 | Float | Double: Numeric
1301+
, Tt <: TensorTypeDenotation, Td <: TensorShapeDenotation, S <: Shape](
13021302
name: String,
1303-
input: Tensor[T, Ax],
1304-
min: Option[Tensor[T, Scalar[Tt, Dd]]] = None,
1305-
max: Option[Tensor[T, Scalar[Tt, Dd]]] = None
1306-
)(using tt: ValueOf[Tt], td: TensorShapeDenotationOf[Td], s: ShapeOf[S]): Tensor[T, Ax] = {
1303+
input: Tensor[T, Tuple3[Tt,Td,S]],
1304+
min: Tensor[T, Tuple3[Tt, Td, SNil]],
1305+
max: Tensor[T, Tuple3[Tt, Td, SNil]]
1306+
)(using tt: ValueOf[Tt], td: TensorShapeDenotationOf[Td], s: ShapeOf[S]): Tensor[T, Tuple3[Tt,Td,S]] = {
13071307
val map: Map[String, Any] = Map()
13081308
val allInputs = Tuple3(input, min, max)
13091309
(callOp(name, "Clip", allInputs, map))
13101310
}
13111311
}
1312-
1312+
/*
13131313
trait ClipV11 extends Operator {
13141314
def ClipV11[
13151315
@sp T <: UByte | UShort | UInt | ULong | Byte | Short | Int | Long | Float16 | Float | Double: Numeric

0 commit comments

Comments
 (0)