Skip to content

Commit f79fa13

Browse files
committed
Update README; format
1 parent 7ea0005 commit f79fa13

File tree

5 files changed

+173
-159
lines changed

5 files changed

+173
-159
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ Automatic differentiation to enable training is under consideration (ONNX does n
191191

192192
Balancing the interests of minimal imposition of dependencies with purely functional programming, ONNX-Scala comes in two flavors: Vanilla and ZIO-infused.
193193

194-
ONNX-Scala is cross-built against Scala JVM (for Scala 2.11, 2.12 and 2.13) , Scala.js / JavaScript (for Scala 2.11, 2.12 and 2.13) and Scala Native (for Scala 2.11).
194+
The ONNX-Scala core API is cross-built against Scala JVM (for Scala 2.11, 2.12 and 2.13) , Scala.js / JavaScript (for Scala 2.11, 2.12 and 2.13) and Scala Native (for Scala 2.11).
195+
The Scala Native build will fail unless you apply this [PR](https://github.com/scala-native/scala-native/pull/1641).
195196

196197
To take advantage of union types to express type constraints, a Dotty (Scala 3) build is available. The Dotty build does not support Scala.js or Scala Native.
197198

backends/src/main/scala/NGraphBackend.scala

Lines changed: 132 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ class NGraphBackend(onnxBytes: Array[Byte])
164164
}
165165

166166
def ArgMax11[@sp T: Numeric: ClassTag](
167-
name: String,
168-
axis: Option[(Int)] = None,
169-
keepdims: Option[(Int)] = None,
170-
data: Option[Tensor[T]]
171-
)(
172-
implicit evT: Contains[T, Union[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[Short]#or[
173-
Int
174-
]#or[Long]#or[Float16]#or[Float]#or[Double]#or[UNil]#create]
175-
): (Tensor[Long]) = ???
167+
name: String,
168+
axis: Option[(Int)] = None,
169+
keepdims: Option[(Int)] = None,
170+
data: Option[Tensor[T]]
171+
)(
172+
implicit evT: Contains[T, Union[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[Short]#or[
173+
Int
174+
]#or[Long]#or[Float16]#or[Float]#or[Double]#or[UNil]#create]
175+
): (Tensor[Long]) = ???
176176

177177
def ArgMin1[@sp T: Numeric: ClassTag](
178178
name: String,
@@ -190,15 +190,15 @@ class NGraphBackend(onnxBytes: Array[Byte])
190190
}
191191

192192
def ArgMin11[@sp T: Numeric: ClassTag](
193-
name: String,
194-
axis: Option[(Int)] = None,
195-
keepdims: Option[(Int)] = None,
196-
data: Option[Tensor[T]]
197-
)(
198-
implicit evT: Contains[T, Union[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[Short]#or[
199-
Int
200-
]#or[Long]#or[Float16]#or[Float]#or[Double]#or[UNil]#create]
201-
): (Tensor[Long]) = ???
193+
name: String,
194+
axis: Option[(Int)] = None,
195+
keepdims: Option[(Int)] = None,
196+
data: Option[Tensor[T]]
197+
)(
198+
implicit evT: Contains[T, Union[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[Short]#or[
199+
Int
200+
]#or[Long]#or[Float16]#or[Float]#or[Double]#or[UNil]#create]
201+
): (Tensor[Long]) = ???
202202

203203
def Constant1[@sp T: Numeric: ClassTag](
204204
name: String,
@@ -227,56 +227,55 @@ class NGraphBackend(onnxBytes: Array[Byte])
227227
}
228228

229229
def Constant11[@sp T: Numeric: ClassTag](
230-
name: String,
231-
sparse_value: Option[(SparseTensor[T])] = None,
232-
value: Option[(Tensor[T])] = None
233-
)(
234-
implicit evT: Contains[
235-
T,
236-
Union[Float16]#or[Float]#or[Double]#or[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[
237-
Short
238-
]#or[Int]#or[Long]#or[String]#or[Boolean]#or[Complex[Float]]#or[Complex[Double]]#or[UNil]#create
239-
]
240-
): (Tensor[T]) = ???
241-
242-
243-
def Equal1[@sp T: Numeric: ClassTag, @sp T1: Numeric: ClassTag](
244-
name: String,
245-
axis: Option[(Int)] = None,
246-
broadcast: Option[(Int)] = None,
247-
A: Option[Tensor[T]],
248-
B: Option[Tensor[T]]
249-
)(
250-
implicit evT: Contains[T, Union[Boolean]#or[Int]#or[Long]#or[UByte]#or[UShort]#or[UInt]#or[
251-
ULong
252-
]#or[Byte]#or[Short]#or[Float16]#or[Float]#or[Double]#or[UNil]#create],
253-
evT1: Contains[T1, Union[Boolean]#or[UNil]#create]
254-
): (Tensor[T1]) = ???
255-
256-
def Equal7[@sp T: Numeric: ClassTag, @sp T1: Numeric: ClassTag](
257-
name: String,
258-
A: Option[Tensor[T]],
259-
B: Option[Tensor[T]]
260-
)(
261-
implicit evT: Contains[T, Union[Boolean]#or[Int]#or[Long]#or[UByte]#or[UShort]#or[UInt]#or[
262-
ULong
263-
]#or[Byte]#or[Short]#or[Float16]#or[Float]#or[Double]#or[UNil]#create],
264-
evT1: Contains[T1, Union[Boolean]#or[UNil]#create]
265-
): (Tensor[T1]) = {
230+
name: String,
231+
sparse_value: Option[(SparseTensor[T])] = None,
232+
value: Option[(Tensor[T])] = None
233+
)(
234+
implicit evT: Contains[
235+
T,
236+
Union[Float16]#or[Float]#or[Double]#or[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[
237+
Short
238+
]#or[Int]#or[Long]#or[String]#or[Boolean]#or[Complex[Float]]#or[Complex[Double]]#or[UNil]#create
239+
]
240+
): (Tensor[T]) = ???
241+
242+
def Equal1[@sp T: Numeric: ClassTag, @sp T1: Numeric: ClassTag](
243+
name: String,
244+
axis: Option[(Int)] = None,
245+
broadcast: Option[(Int)] = None,
246+
A: Option[Tensor[T]],
247+
B: Option[Tensor[T]]
248+
)(
249+
implicit evT: Contains[T, Union[Boolean]#or[Int]#or[Long]#or[UByte]#or[UShort]#or[UInt]#or[
250+
ULong
251+
]#or[Byte]#or[Short]#or[Float16]#or[Float]#or[Double]#or[UNil]#create],
252+
evT1: Contains[T1, Union[Boolean]#or[UNil]#create]
253+
): (Tensor[T1]) = ???
254+
255+
def Equal7[@sp T: Numeric: ClassTag, @sp T1: Numeric: ClassTag](
256+
name: String,
257+
A: Option[Tensor[T]],
258+
B: Option[Tensor[T]]
259+
)(
260+
implicit evT: Contains[T, Union[Boolean]#or[Int]#or[Long]#or[UByte]#or[UShort]#or[UInt]#or[
261+
ULong
262+
]#or[Byte]#or[Short]#or[Float16]#or[Float]#or[Double]#or[UNil]#create],
263+
evT1: Contains[T1, Union[Boolean]#or[UNil]#create]
264+
): (Tensor[T1]) = {
266265
//(trinaryOpNoAttrs(name, "Equal", A, B, None))
267266
???
268267
}
269-
268+
270269
def Equal11[@sp T: Numeric: ClassTag, @sp T1: Numeric: ClassTag](
271-
name: String,
272-
A: Option[Tensor[T]],
273-
B: Option[Tensor[T]]
274-
)(
275-
implicit evT: Contains[T, Union[Boolean]#or[Int]#or[Long]#or[UByte]#or[UShort]#or[UInt]#or[
276-
ULong
277-
]#or[Byte]#or[Short]#or[Float16]#or[Float]#or[Double]#or[UNil]#create],
278-
evT1: Contains[T1, Union[Boolean]#or[UNil]#create]
279-
): (Tensor[T1]) = ???
270+
name: String,
271+
A: Option[Tensor[T]],
272+
B: Option[Tensor[T]]
273+
)(
274+
implicit evT: Contains[T, Union[Boolean]#or[Int]#or[Long]#or[UByte]#or[UShort]#or[UInt]#or[
275+
ULong
276+
]#or[Byte]#or[Short]#or[Float16]#or[Float]#or[Double]#or[UNil]#create],
277+
evT1: Contains[T1, Union[Boolean]#or[UNil]#create]
278+
): (Tensor[T1]) = ???
280279

281280
def GlobalAveragePool1[@sp T: Numeric: ClassTag](
282281
name: String,
@@ -347,11 +346,11 @@ class NGraphBackend(onnxBytes: Array[Byte])
347346
}
348347

349348
def Softmax11[@sp T: Numeric: ClassTag](
350-
name: String,
351-
axis: Option[(Int)] = None,
352-
input: Option[Tensor[T]]
353-
)(implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create]): (Tensor[T]) = ???
354-
349+
name: String,
350+
axis: Option[(Int)] = None,
351+
input: Option[Tensor[T]]
352+
)(implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create]): (Tensor[T]) =
353+
???
355354

356355
def Mul1[@sp T: Numeric: ClassTag](
357356
name: String,
@@ -481,20 +480,20 @@ class NGraphBackend(onnxBytes: Array[Byte])
481480
}
482481

483482
def Gemm11[@sp T: Numeric: ClassTag](
484-
name: String,
485-
alpha: Option[(Float)] = None,
486-
beta: Option[(Float)] = None,
487-
transA: Option[(Int)] = None,
488-
transB: Option[(Int)] = None,
489-
A: Option[Tensor[T]],
490-
B: Option[Tensor[T]],
491-
C: Option[Tensor[T]] = None
492-
)(
493-
implicit evT: Contains[
494-
T,
495-
Union[Float16]#or[Float]#or[Double]#or[UInt]#or[ULong]#or[Int]#or[Long]#or[UNil]#create
496-
]
497-
): (Tensor[T]) = ???
483+
name: String,
484+
alpha: Option[(Float)] = None,
485+
beta: Option[(Float)] = None,
486+
transA: Option[(Int)] = None,
487+
transB: Option[(Int)] = None,
488+
A: Option[Tensor[T]],
489+
B: Option[Tensor[T]],
490+
C: Option[Tensor[T]] = None
491+
)(
492+
implicit evT: Contains[
493+
T,
494+
Union[Float16]#or[Float]#or[Double]#or[UInt]#or[ULong]#or[Int]#or[Long]#or[UNil]#create
495+
]
496+
): (Tensor[T]) = ???
498497

499498
def Gather1[@sp T: Numeric: ClassTag, @sp Tind: Numeric: ClassTag](
500499
name: String,
@@ -512,19 +511,19 @@ class NGraphBackend(onnxBytes: Array[Byte])
512511
(trinaryOpNoAttrs(name, "Gather", data, indices, None: Option[Tensor[T]]))
513512
}
514513

515-
def Gather11[@sp T: Numeric: ClassTag, @sp Tind: Numeric: ClassTag](
516-
name: String,
517-
axis: Option[(Int)] = None,
518-
data: Option[Tensor[T]],
519-
indices: Option[Tensor[Tind]]
520-
)(
521-
implicit evT: Contains[T, Union[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[Short]#or[
522-
Int
523-
]#or[Long]#or[Float16]#or[Float]#or[Double]#or[String]#or[Boolean]#or[Complex[Float]]#or[
524-
Complex[Double]
525-
]#or[UNil]#create],
526-
evTind: Contains[Tind, Union[Int]#or[Long]#or[UNil]#create]
527-
): (Tensor[T]) = ???
514+
def Gather11[@sp T: Numeric: ClassTag, @sp Tind: Numeric: ClassTag](
515+
name: String,
516+
axis: Option[(Int)] = None,
517+
data: Option[Tensor[T]],
518+
indices: Option[Tensor[Tind]]
519+
)(
520+
implicit evT: Contains[T, Union[UByte]#or[UShort]#or[UInt]#or[ULong]#or[Byte]#or[Short]#or[
521+
Int
522+
]#or[Long]#or[Float16]#or[Float]#or[Double]#or[String]#or[Boolean]#or[Complex[Float]]#or[
523+
Complex[Double]
524+
]#or[UNil]#create],
525+
evTind: Contains[Tind, Union[Int]#or[Long]#or[UNil]#create]
526+
): (Tensor[T]) = ???
528527

529528
def Conv1[@sp T: Numeric: ClassTag](
530529
name: String,
@@ -553,18 +552,19 @@ class NGraphBackend(onnxBytes: Array[Byte])
553552
trinaryOp(name, "Conv", X, W, B, map)
554553
}
555554

556-
def Conv11[@sp T: Numeric: ClassTag](
557-
name: String,
558-
auto_pad: Option[(String)] = None,
559-
dilations: Option[(Array[Int])] = None,
560-
group: Option[(Int)] = None,
561-
kernel_shape: Option[(Array[Int])] = None,
562-
pads: Option[(Array[Int])] = None,
563-
strides: Option[(Array[Int])] = None,
564-
X: Option[Tensor[T]],
565-
W: Option[Tensor[T]],
566-
B: Option[Tensor[T]] = None
567-
)(implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create]): (Tensor[T]) = ???
555+
def Conv11[@sp T: Numeric: ClassTag](
556+
name: String,
557+
auto_pad: Option[(String)] = None,
558+
dilations: Option[(Array[Int])] = None,
559+
group: Option[(Int)] = None,
560+
kernel_shape: Option[(Array[Int])] = None,
561+
pads: Option[(Array[Int])] = None,
562+
strides: Option[(Array[Int])] = None,
563+
X: Option[Tensor[T]],
564+
W: Option[Tensor[T]],
565+
B: Option[Tensor[T]] = None
566+
)(implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create]): (Tensor[T]) =
567+
???
568568

569569
/*
570570
val inputs: Seq[String] = node.input
@@ -862,7 +862,7 @@ class NGraphBackend(onnxBytes: Array[Byte])
862862
B: Option[Tensor[T1]],
863863
C: Option[Tensor[T2]]
864864
): (Tensor[T3]) = {
865-
val scope = new PointerScope()
865+
val scope = new PointerScope()
866866
val modelString = new BytePointer(opModel: _*)
867867
val ngraphFunc = import_onnx_model(modelString)
868868
modelString.close
@@ -1044,20 +1044,19 @@ class NGraphBackend(onnxBytes: Array[Byte])
10441044
): (Tensor[T], Tensor[I]) = ???
10451045

10461046
def MaxPool11[@sp T: Numeric: ClassTag, @sp I: Numeric: ClassTag](
1047-
name: String,
1048-
auto_pad: Option[(String)] = None,
1049-
ceil_mode: Option[(Int)] = None,
1050-
dilations: Option[(Array[Int])] = None,
1051-
kernel_shape: Option[(Array[Int])],
1052-
pads: Option[(Array[Int])] = None,
1053-
storage_order: Option[(Int)] = None,
1054-
strides: Option[(Array[Int])] = None,
1055-
X: Option[Tensor[T]]
1056-
)(
1057-
implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create],
1058-
evI: Contains[I, Union[Long]#or[UNil]#create]
1059-
): (Tensor[T], Tensor[I]) = ???
1060-
1047+
name: String,
1048+
auto_pad: Option[(String)] = None,
1049+
ceil_mode: Option[(Int)] = None,
1050+
dilations: Option[(Array[Int])] = None,
1051+
kernel_shape: Option[(Array[Int])],
1052+
pads: Option[(Array[Int])] = None,
1053+
storage_order: Option[(Int)] = None,
1054+
strides: Option[(Array[Int])] = None,
1055+
X: Option[Tensor[T]]
1056+
)(
1057+
implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create],
1058+
evI: Contains[I, Union[Long]#or[UNil]#create]
1059+
): (Tensor[T], Tensor[I]) = ???
10611060

10621061
def Concat4[@sp T: Numeric: ClassTag](
10631062
name: String,
@@ -1145,15 +1144,16 @@ class NGraphBackend(onnxBytes: Array[Byte])
11451144
): (Tensor[T]) = ???
11461145

11471146
def AveragePool11[@sp T: Numeric: ClassTag](
1148-
name: String,
1149-
auto_pad: Option[(String)] = None,
1150-
ceil_mode: Option[(Int)] = None,
1151-
count_include_pad: Option[(Int)] = None,
1152-
kernel_shape: Option[(Array[Int])],
1153-
pads: Option[(Array[Int])] = None,
1154-
strides: Option[(Array[Int])] = None,
1155-
X: Option[Tensor[T]]
1156-
)(implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create]): (Tensor[T]) = ???
1147+
name: String,
1148+
auto_pad: Option[(String)] = None,
1149+
ceil_mode: Option[(Int)] = None,
1150+
count_include_pad: Option[(Int)] = None,
1151+
kernel_shape: Option[(Array[Int])],
1152+
pads: Option[(Array[Int])] = None,
1153+
strides: Option[(Array[Int])] = None,
1154+
X: Option[Tensor[T]]
1155+
)(implicit evT: Contains[T, Union[Float16]#or[Float]#or[Double]#or[UNil]#create]): (Tensor[T]) =
1156+
???
11571157

11581158
def Reshape1[@sp T: Numeric: ClassTag](
11591159
name: String,

0 commit comments

Comments
 (0)