File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/AdapterSelection Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ public AdapterSelection()
3434 adapter_options . AddRange ( adapters ) ;
3535 AdapterListView . ItemsSource = adapter_options ;
3636
37+ // Run in background thread to avoid blocking UI on sample launch
3738 Task . Run ( ( ) => SetModelNameForTelemetry ( device ) ) ;
3839 }
3940
@@ -103,14 +104,15 @@ private List<string> RemoveMicrosoftBasicRenderDriver(string[] adapters_arr)
103104 return adapters ;
104105 }
105106
107+ // Session must be created for telemety to be sent
106108 private void SetModelNameForTelemetry ( LearningModelDevice device )
107109 {
108110 var modelName = "squeezenet1.1-7.onnx" ;
109111 var modelPath = Path . Join ( Windows . ApplicationModel . Package . Current . InstalledLocation . Path , "Models" , modelName ) ;
110112 var model = LearningModel . LoadFromFilePath ( modelPath ) ;
111113 var options = new LearningModelSessionOptions ( ) ;
112114 SampleBasePage . SetModelNameForTelemetry ( "SqueezeNet" , "AdapterSelection" , model ) ;
113- var session = new LearningModelSession ( model , device , options ) ;
115+ new LearningModelSession ( model , device , options ) ;
114116 }
115117 }
116118}
You can’t perform that action at this time.
0 commit comments