| 37 | }; |
| 38 | |
| 39 | TEST(NNKIT_TF_PARSER, success_case) |
| 40 | { |
| 41 | // clang-format off |
| 42 | TensorInfo tc_list[] = { |
| 43 | {"input, in/placeholder_1:0, TF_FLOAT, [3, 2] # correct case", |
| 44 | ParsedTensor::Kind::Input, "in/placeholder_1:0", TF_FLOAT, 2, {3, 2} }, |
| 45 | |
| 46 | {"output, aa/bb.cc:0, TF_FLOAT, []", // empty shape |
| 47 | ParsedTensor::Kind::Output, "aa/bb.cc:0", TF_FLOAT, 0, {0, 0} }, |
| 48 | |
| 49 | {"output, aa:0, TF_FLOAT, [] # this is a comment", // string with comment |
| 50 | ParsedTensor::Kind::Output, "aa:0", TF_FLOAT, 0, {0, 0} }, |
| 51 | |
| 52 | {"output, ...:0, TF_FLOAT, [] # this is a comment", // name test. TF works with this name |
| 53 | ParsedTensor::Kind::Output, "...:0", TF_FLOAT, 0, {0, 0} }, |
| 54 | }; |
| 55 | // clang-format on |
| 56 | |
| 57 | for (auto tc : tc_list) |
| 58 | { |
| 59 | std::unique_ptr<ParsedTensor> tensor = parse_line(tc.line); |
| 60 | |
| 61 | ASSERT_EQ(tensor->kind(), tc.kind); |
| 62 | ASSERT_EQ(tensor->name(), tc.name); |
| 63 | ASSERT_EQ(tensor->dtype(), tc.dtype); |
| 64 | ASSERT_EQ(tensor->shape().rank(), tc.rank); |
| 65 | for (int d = 0; d < tc.rank; d++) |
| 66 | ASSERT_EQ(tensor->shape().dim(d), tc.dim[d]); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | TEST(NNKIT_TF_PARSER, failure_case) |
| 71 | { |