File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/DXResourceBindingORT Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -31,6 +31,9 @@ public sealed partial class DXResourceBindingORT : Page
3131 public DXResourceBindingORT ( )
3232 {
3333 this . InitializeComponent ( ) ;
34+
35+ // Run in background thread to avoid blocking UI on sample launch
36+ Task . Run ( ( ) => SetModelNameForTelemetry ( ) ) ;
3437 }
3538
3639 private async void LaunchWindow ( object sender , RoutedEventArgs e )
@@ -105,5 +108,17 @@ public void StopAllEvents()
105108 {
106109 pageExited = true ;
107110 }
111+
112+ // Session must be created for telemety to be sent
113+ private void SetModelNameForTelemetry ( )
114+ {
115+ var modelName = "squeezenet1.1-7.onnx" ;
116+ var modelPath = Path . Join ( Windows . ApplicationModel . Package . Current . InstalledLocation . Path , "Models" , modelName ) ;
117+ var model = LearningModel . LoadFromFilePath ( modelPath ) ;
118+ var device = new LearningModelDevice ( LearningModelDeviceKind . Cpu ) ;
119+ var options = new LearningModelSessionOptions ( ) ;
120+ SampleBasePage . SetModelNameForTelemetry ( "SqueezeNet" , "AdapterSelection" , model ) ;
121+ new LearningModelSession ( model , device , options ) ;
122+ }
108123 }
109124}
You can’t perform that action at this time.
0 commit comments