Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
import { Env, InferenceSession, Tensor } from 'onnxruntime-common';
 
import { Attribute } from '../lib/onnxjs/attribute';
import { Logger } from '../lib/onnxjs/instrument';
 
export declare namespace Test {
  export interface NamedTensor extends Tensor {
    name: string;
  }
 
  /**
   * This interface represent a value of Attribute. Should only be used in testing.
   */
  export interface AttributeValue {
    name: string;
    data: Attribute.DataTypeMap[Attribute.DataType];
    type: Attribute.DataType;
  }
 
  /**
   * This interface represent a value of Tensor. Should only be used in testing.
   */
  export interface TensorValue {
    data: number[];
    dims: number[];
    type: Tensor.Type;
  }
 
  /**
   * This interface represent a placeholder for an empty tensor. Should only be used in testing.
   */
  interface EmptyTensorValue {
    data: null;
    type: Tensor.Type;
  }
 
  /**
   * Represent a string to describe the current environment.
   * Used in ModelTest and OperatorTest to determine whether to run the test or not.
   */
  export type PlatformCondition = string;
 
  /**
   * The IOBindingMode represents how to test a model with GPU data.
   *
   * - none: inputs will be pre-allocated as CPU tensors; no output will be pre-allocated; `preferredOutputLocation`
   * will not be set.
   * - gpu-location: inputs will be pre-allocated as GPU tensors; no output will be pre-allocated;
   * `preferredOutputLocation` will be set to `gpu-buffer`.
   * - gpu-tensor: inputs and outputs will all be pre-allocated as GPU tensors. `preferredOutputLocation`
   * will not be set.
   * - ml-location: inputs will be pre-allocated as ML tensors; no output will be pre-allocated;
   * `preferredOutputLocation` will be set to `ml-tensor`.
   * - ml-tensor: inputs and outputs will all be pre-allocated as MLTensor tensors. `preferredOutputLocation`
   * will not be set.
   */
  export type IOBindingMode = 'none' | 'gpu-tensor' | 'gpu-location' | 'ml-tensor' | 'ml-location';
 
  export interface ModelTestCase {
    name: string;
    dataFiles: readonly string[];
    inputs?: NamedTensor[]; // value should be populated at runtime
    outputs?: NamedTensor[]; // value should be populated at runtime
  }
 
  export interface ModelTest {
    name: string;
    modelUrl: string;
    externalData?: InferenceSession.SessionOptions['externalData'];
    backend?: string; // value should be populated at build time
    ioBinding: IOBindingMode;
    platformCondition?: PlatformCondition;
    cases: readonly ModelTestCase[];
  }
 
  export interface ModelTestGroup {
    name: string;
    tests: readonly ModelTest[];
  }
 
  export interface OperatorTestCase {
    name: string;
    inputs: ReadonlyArray<TensorValue | EmptyTensorValue>;
    outputs: ReadonlyArray<TensorValue | EmptyTensorValue>;
  }
 
  export interface OperatorTestOpsetImport {
    domain: string;
    version: number;
  }
 
  export type InputShapeDefinition = ReadonlyArray<number | string>;
 
  export interface OperatorTest {
    name: string;
    operator: string;
    inputShapeDefinitions?: 'none' | 'rankOnly' | 'static' | ReadonlyArray<InputShapeDefinition | undefined>;
    opset?: OperatorTestOpsetImport;
    backend?: string; // value should be populated at build time
    ioBinding: IOBindingMode;
    platformCondition?: PlatformCondition;
    attributes?: readonly AttributeValue[];
    cases: readonly OperatorTestCase[];
  }
 
  export interface OperatorTestGroup {
    name: string;
    tests: readonly OperatorTest[];
  }
 
  export namespace TestList {
    export type TestName = string;
    export interface TestDescription {
      name: string;
      platformCondition: PlatformCondition;
    }
    export type Test = TestName | TestDescription;
  }
 
  /**
   * The data schema of a testlist file.
   * A testlist should only be applied when running suite test cases (suite0)
   */
  export interface TestList {
    [backend: string]: { [group: string]: readonly TestList.Test[] };
  }
 
  interface EnvOptions extends Partial<Omit<Env, 'wasm' | 'webgl' | 'webgpu'>> {
    wasm: Partial<Env.WebAssemblyFlags>;
    webgl: Partial<Env.WebGLFlags>;
    webgpu: Partial<Env.WebGpuFlags>;
    logLevel?: Env['logLevel'];
  }
 
  /**
   * Represent ONNX Runtime Web global options
   */
  export interface Options {
    debug?: boolean;
    sessionOptions?: InferenceSession.SessionOptions;
    cpuOptions?: InferenceSession.CpuExecutionProviderOption;
    cpuFlags?: Record<string, unknown>;
    cudaOptions?: InferenceSession.CudaExecutionProviderOption;
    cudaFlags?: Record<string, unknown>;
    wasmOptions?: InferenceSession.WebAssemblyExecutionProviderOption;
    webglOptions?: InferenceSession.WebGLExecutionProviderOption;
    webnnOptions?: InferenceSession.WebNNExecutionProviderOption;
    globalEnvFlags?: EnvOptions;
  }
 
  /**
   * Represent a file cache map that preload the files in prepare stage.
   * The key is the file path and the value is the file content in BASE64.
   */
  export interface FileCache {
    [filePath: string]: string;
  }
 
  /**
   * The data schema of a test config.
   */
  export interface Config {
    unittest: boolean;
    op: readonly OperatorTestGroup[];
    model: readonly ModelTestGroup[];
 
    fileCacheUrls?: readonly string[];
 
    log: ReadonlyArray<{ category: string; config: Logger.Config }>;
    profile: boolean;
    downloadModel: boolean;
    options: Options;
  }
}