• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
2 
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6 
7     http://www.apache.org/licenses/LICENSE-2.0
8 
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 ==============================================================================*/
15 
16 #ifndef TENSORFLOW_COMPILER_XLA_CLIENT_LIB_TESTING_H_
17 #define TENSORFLOW_COMPILER_XLA_CLIENT_LIB_TESTING_H_
18 
19 #include <memory>
20 #include <vector>
21 
22 #include "tensorflow/compiler/xla/client/client.h"
23 #include "tensorflow/compiler/xla/client/global_data.h"
24 #include "tensorflow/compiler/xla/client/xla_computation.h"
25 #include "tensorflow/compiler/xla/xla_data.pb.h"
26 
27 namespace xla {
28 
29 // Generates fake data of the given shape on the device or dies. The fake data
30 // is created by performing a computation on the device rather than transferring
31 // data from the host to the device.
32 //
33 // The optional DebugOptions are used when generating fake data on the device.
34 std::unique_ptr<GlobalData> MakeFakeDataOrDie(
35     const Shape& shape, Client* client, DebugOptions* debug_opts = nullptr);
36 
37 // Returns vector of GlobalData handles of fake data (created using
38 // MakeFakeDataOrDie) that are correctly shaped arguments for the given
39 // xla computation.
40 //
41 // The optional DebugOptions are used when generating fake data on the device.
42 std::vector<std::unique_ptr<GlobalData>> MakeFakeArgumentsOrDie(
43     const XlaComputation& computation, Client* client,
44     DebugOptions* debug_opts = nullptr);
45 
46 }  // namespace xla
47 
48 #endif  // TENSORFLOW_COMPILER_XLA_CLIENT_LIB_TESTING_H_
49