Benign repos Download

ifrt_serving_executable_test.cc

Google Test frameworkimports tensorflow/core/platform/test.h
SHA-256fab58fcbc11ae7eff774789fddf8a220ddb4a1d16027ff3d831a736c67dd369b

Evidence

apache web server name lines 1–10
1/* Copyright 2023 The TensorFlow Authors. All Rights Reserved.
2
3Licensed under the Apache License, Version 2.0 (the "License");
4you may not use this file except in compliance with the License.
5You may obtain a copy of the License at
6
7 http://www.apache.org/licenses/LICENSE-2.0
8
9Unless required by applicable law or agreed to in writing, software
10distributed under the License is …
imports tensorflow/core/platform/test.h lines 11–58
11:42… IND, either express or implied.
12See the License for the specific language governing permissions and
13limitations under the License.
14==============================================================================*/
15
16#include "tensorflow/core/tfrt/ifrt/ifrt_serving_executable.h"
17
18#include <cstdint>
19#include <memory>
20#include <string>
21#include <vector>
22
23#include <gmock/gmock.h>
24#include <gtest/gtest.h>
25#include "absl/log/check.h"
26#include "absl/status/status.h"
27#include "absl/status/status_matchers.h"
28#include "absl/status/statusor.h"
29#include "absl/strings/str_cat.h"
30#include "absl/strings/string_view.h"
31#include "absl/types/span.h"
32#include "mlir/Dialect/Func/IR/FuncOps.h" // from @llvm-project
33#include "mlir/IR/BuiltinOps.h" // from @llvm-project
34#include "mlir/IR/DialectRegistry.h" // from @llvm-project
35#include "mlir/IR/MLIRContext.h" // from @llvm-project
36#include "mlir/IR/OwningOpRef.h" // from @llvm-project
37#include "mlir/InitAllDialects.h" // from @llvm-project
38#include "mlir/Parser/Parser.h" // from @llvm-project
39#include "mlir/Support/LLVM.h" // from @llvm-project
40#include "tensorflow/compiler/mlir/tensorflow/dialect_registration.h"
41#include "tensorflow/compiler/mlir/tfrt/transforms/ifrt/ifrt_types.h"
42#include "xla/python/ifrt/test_util.h"
43#include "xla/shape.h"
44#include "xla/shape_util.h"
45#include "xla/tsl/concurrency/future.h"
46#include "xla/tsl/framework/serving_device_selector.h"
47#include "xla/tsl/framework/test_util/mock_serving_device_selector.h"
48#include "xla/tsl/lib/core/status_test_util.h"
49#include "xla/tsl/platform/statusor.h"
50#include "xla/xla_data.pb.h"
51#include "tensorflow/core/framework/tensor.h"
52#include "tensorflow/core/framework/tensor_matcher.h"
53#include "tensorflow/core/framework/tensor_shape.h"
54#include "tensorflow/core/framework/tensor_testutil.h"
55#include "tensorflow/core/framework/types.pb.h"
56#include "tensorflow/core/platform/test.h"
57#include "tensorflow/core/tfrt/ifrt/ifrt_restore_tensor_registry.h"
58#include "tensorflow/core/tfrt/ifrt/ifrt_serving_executable_test_util.h"
TEST_F macro lines 87–92
87:13… e_ptr<test_utils::IfrtServingExecutableTestHelper> helper_;
88};
89
90TEST_F(IfrtServingExecutableTest, Basic) {
91 int64_t program_id = 123456;
92 EXPECT_CALL(selector_, ReserveDevice(absl::StrCat(program_ …
C/C++ unit-test ASSERT_EQ marker lines 145–152
145:23… executable->Execute(absl::MakeSpan(inputs2), {}));
146 }
147
148 ASSERT_EQ(executable->num_executables(), 2);
149
150 EXPECT_THAT(outputs1, ElementsAre(TensorEq(expected_out1)));
151
152 EXPECT_THAT(outputs2, Ele …
C/C++ unit-test EXPECT_EQ marker lines 307–312
307:16… func.getArgAttr(0, "mhlo.layout_mode");
308 ASSERT_TRUE(attr0);
309 EXPECT_EQ(mlir::cast<mlir::StringAttr>(attr0).getValue(), "{1,0}");
310
311 auto attr1 = func.getArgAttr(1, "mhlo.layout_mode");
312 ASSERT_TRUE …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.