-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathExecutionProvider.cs
More file actions
29 lines (25 loc) · 911 Bytes
/
ExecutionProvider.cs
File metadata and controls
29 lines (25 loc) · 911 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) TensorStack. All rights reserved.
// Licensed under the Apache 2.0 License.
using Microsoft.ML.OnnxRuntime;
using System;
namespace TensorStack.Common
{
public class ExecutionProvider
{
private readonly string _name;
private readonly OrtMemoryInfo _memoryInfo;
private readonly Func<ModelConfig, SessionOptions> _sessionOptionsFactory;
public ExecutionProvider(string name, OrtMemoryInfo memoryInfo, Func<ModelConfig, SessionOptions> sessionOptionsFactory)
{
_name = name;
_memoryInfo = memoryInfo;
_sessionOptionsFactory = sessionOptionsFactory;
}
public string Name => _name;
public OrtMemoryInfo MemoryInfo => _memoryInfo;
public SessionOptions CreateSession(ModelConfig modelConfig)
{
return _sessionOptionsFactory(modelConfig);
}
}
}