@@ -242,6 +242,17 @@ extension XLATensor {
242
242
}
243
243
}
244
244
245
+ static func annotate( _ a: XLATensor , _ annotation: String ) -> XLATensor {
246
+ return XLATensor ( _handle: XLATensor_annotate ( a. handle, annotation) )
247
+ }
248
+
249
+ static func annotations( _ a: XLATensor ) -> String {
250
+ // TODO(michellecasbon): Format with header.
251
+ let str = XLATensor_get_annotations ( a. handle)
252
+ defer { DeleteString ( str) }
253
+ return String ( cString: GetStringCStr ( str) )
254
+ }
255
+
245
256
static func any( _ input: XLATensor , _ reductionIndices: [ Int64 ] , _ keepDims: Bool ) -> XLATensor {
246
257
defer { _fixLifetime ( input) }
247
258
return reductionIndices. withArrayRef { reductionIndices in
@@ -407,7 +418,9 @@ extension XLATensor {
407
418
return XLATensor ( _handle: XLATensor_div ( a. handle, b. handle) )
408
419
}
409
420
410
- static func dynamic_slice( _ base: XLATensor , _ start_indices: [ XLATensor ] , _ slice_shape: [ Int64 ] ) -> XLATensor {
421
+ static func dynamic_slice( _ base: XLATensor , _ start_indices: [ XLATensor ] , _ slice_shape: [ Int64 ] )
422
+ -> XLATensor
423
+ {
411
424
start_indices. withArrayRef { start_indices in
412
425
slice_shape. withArrayRef { slice_shape in
413
426
return XLATensor ( _handle: XLATensor_dynamic_slice ( base. handle, start_indices, slice_shape) )
@@ -491,6 +504,12 @@ extension XLATensor {
491
504
}
492
505
}
493
506
507
+ static func irText( _ a: XLATensor ) -> String {
508
+ let str = XLATensor_ir_text ( a. handle)
509
+ defer { DeleteString ( str) }
510
+ return String ( cString: GetStringCStr ( str) )
511
+ }
512
+
494
513
static func isFinite( _ input: XLATensor ) -> XLATensor {
495
514
defer { _fixLifetime ( input) }
496
515
return XLATensor ( _handle: XLATensor_is_finite ( input. handle) )
@@ -761,7 +780,7 @@ extension XLATensor {
761
780
}
762
781
763
782
static func replica_id( _ device: Device ) -> XLATensor {
764
- return XLATensor ( _handle: XLATensor_replica_id ( device. cdevice) ) ;
783
+ return XLATensor ( _handle: XLATensor_replica_id ( device. cdevice) )
765
784
}
766
785
767
786
static func resize_value( _ value: XLATensor , _ dims: [ Int64 ] ) -> XLATensor {
@@ -841,12 +860,6 @@ extension XLATensor {
841
860
}
842
861
}
843
862
844
- static func irText( _ a: XLATensor ) -> String {
845
- let str = XLATensor_ir_text ( a. handle)
846
- defer { DeleteString ( str) }
847
- return String ( cString: GetStringCStr ( str) )
848
- }
849
-
850
863
static func sub( _ a: XLATensor , _ b: XLATensor ) -> XLATensor {
851
864
defer { _fixLifetime ( a) }
852
865
defer { _fixLifetime ( b) }
0 commit comments