Исходный код СУБД 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
#include "gtest/gtest.h"
#include "test/providers/provider_test_utils.h"
 
namespace onnxruntime {
namespace test {
 
static void RunTest(const std::vector<int64_t>& dims, const std::vector<std::string>& input1,
                    const std::vector<std::string>& input2, const std::vector<std::string>& output) {
  OpTester test("StringConcat", 20, onnxruntime::kOnnxDomain);
  test.AddInput<std::string>("X", dims, input1);
  test.AddInput<std::string>("Y", dims, input2);
  test.AddOutput<std::string>("Z", dims, output);
  test.Run();
}
 
TEST(StringConcat, BasicConcatenation) {
  RunTest({1, 2}, {"Hello", "World"}, {"Hello", "World"}, {"HelloHello", "WorldWorld"});
}
 
TEST(StringConcat, TwoDimensionalConcatenation) {
  RunTest({2, 2}, {"Hello", "World", "ONNX", "onnxruntime"}, {"Hello", "World", "ONNX", "onnxruntime"},
          {"HelloHello", "WorldWorld", "ONNXONNX", "onnxruntimeonnxruntime"});
}
 
TEST(StringConcat, LeftToRightBroadcastingConcatenation) {
  OpTester test("StringConcat", 20, onnxruntime::kOnnxDomain);
  test.AddInput<std::string>("X", {2, 2}, {"Hello", "World", "ONNX", "onnxruntime"});
  test.AddInput<std::string>("Y", {1}, {"!"});
  test.AddOutput<std::string>("Z", {2, 2}, {"Hello!", "World!", "ONNX!", "onnxruntime!"});
  test.Run();
}
 
TEST(StringConcat, RightToLeftBroadcastingConcatenation) {
  OpTester test("StringConcat", 20, onnxruntime::kOnnxDomain);
  test.AddInput<std::string>("X", {1}, {"!"});
  test.AddInput<std::string>("Y", {2, 2}, {"Hello", "World", "ONNX", "onnxruntime"});
  test.AddOutput<std::string>("Z", {2, 2}, {"!Hello", "!World", "!ONNX", "!onnxruntime"});
  test.Run();
}
 
TEST(StringConcat, BidirectionalBroadcastingConcatenation) {
  OpTester test("StringConcat", 20, onnxruntime::kOnnxDomain);
  test.AddInput<std::string>("X", {2, 1, 3}, {"a", "b", "c", "d", "e", "f"});
  test.AddInput<std::string>("Y", {1, 4, 3}, {"a", "b", "c", "d", "e", "f", "g", "h", "i", "k", "l", "m"});
  test.AddOutput<std::string>("Z", {2, 4, 3},
                              {
                                  "aa",
                                  "bb",
                                  "cc",
                                  "ad",
                                  "be",
                                  "cf",
                                  "ag",
                                  "bh",
                                  "ci",
                                  "ak",
                                  "bl",
                                  "cm",
                                  "da",
                                  "eb",
                                  "fc",
                                  "dd",
                                  "ee",
                                  "ff",
                                  "dg",
                                  "eh",
                                  "fi",
                                  "dk",
                                  "el",
                                  "fm",
                              });
  test.Run();
}
 
}  // namespace test
}  // namespace onnxruntime