Skip to content

Commit 5848ef7

Browse files
committed
Add comment for background thread
1 parent 9056f56 commit 5848ef7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Samples/WinMLSamplesGallery/WinMLSamplesGallery/Samples/AdapterSelection/AdapterSelection.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)