File tree 3 files changed +23
-1
lines changed
3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -380,6 +380,13 @@ impl Interpreter {
380
380
} ) ;
381
381
Ok ( ( ) )
382
382
}
383
+
384
+ /// Wait for all output tensors to be ready after computation
385
+ pub fn wait ( & self , session : & crate :: session:: Session ) {
386
+ self . outputs ( session) . iter ( ) . for_each ( |tinfo| {
387
+ tinfo. raw_tensor ( ) . wait_read ( true ) ;
388
+ } ) ;
389
+ }
383
390
}
384
391
385
392
#[ repr( transparent) ]
@@ -586,6 +593,7 @@ impl OperatorInfo<'_> {
586
593
}
587
594
588
595
#[ test]
596
+ #[ ignore = "This test doesn't work in CI" ]
589
597
fn test_run_session_with_callback_info_api ( ) {
590
598
let file = Path :: new ( "tests/assets/realesr.mnn" )
591
599
. canonicalize ( )
@@ -603,6 +611,7 @@ fn test_run_session_with_callback_info_api() {
603
611
}
604
612
605
613
#[ test]
614
+ #[ ignore = "This test doesn't work in CI" ]
606
615
fn check_whether_sync_actually_works ( ) {
607
616
let file = Path :: new ( "tests/assets/realesr.mnn" )
608
617
. canonicalize ( )
@@ -633,6 +642,7 @@ fn check_whether_sync_actually_works() {
633
642
}
634
643
635
644
#[ test]
645
+ #[ ignore = "This test doesn't work in CI" ]
636
646
fn try_to_drop_interpreter_before_session ( ) {
637
647
let file = Path :: new ( "tests/assets/realesr.mnn" )
638
648
. canonicalize ( )
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ macro_rules! profile {
9
9
} ;
10
10
let elapsed = now. elapsed( ) ;
11
11
#[ cfg( feature = "tracing" ) ]
12
- tracing:: trace !( "{}: Elapsed time: {:?}" , $message, elapsed) ;
12
+ tracing:: info !( "{}: Elapsed time: {:?}" , $message, elapsed) ;
13
13
result
14
14
} }
15
15
}
Original file line number Diff line number Diff line change @@ -720,6 +720,18 @@ impl<'r> RawTensor<'r> {
720
720
self . shape ( ) . as_ref ( ) . contains ( & -1 )
721
721
}
722
722
723
+ pub fn wait_read ( & self , finish : bool ) {
724
+ unsafe {
725
+ Tensor_wait ( self . inner , MapType :: MAP_TENSOR_READ , finish as i32 ) ;
726
+ }
727
+ }
728
+
729
+ pub fn wait_write ( & self , finish : bool ) {
730
+ unsafe {
731
+ Tensor_wait ( self . inner , MapType :: MAP_TENSOR_WRITE , finish as i32 ) ;
732
+ }
733
+ }
734
+
723
735
/// # Safety
724
736
/// This is very unsafe do not use this unless you know what you are doing
725
737
pub unsafe fn to_concrete < T : super :: TensorType > ( self ) -> super :: Tensor < T >
You can’t perform that action at this time.
0 commit comments