"//tensorflow/compiler/xla/client:computation",
"//tensorflow/compiler/xla/client:computation_builder",
"//tensorflow/compiler/xla/client:global_data",
+ "//tensorflow/compiler/xla/client/xla_client:xla_computation",
"//tensorflow/compiler/xla/tests:test_utils",
"//tensorflow/core:lib",
],
return fake_arguments;
}
+std::vector<std::unique_ptr<GlobalData>> MakeFakeArgumentsOrDie(
+ const XlaComputation& computation, Client* client) {
+ CHECK(computation.proto().has_program_shape())
+ << "Computation should have progran shape.";
+ auto program_shape = computation.proto().program_shape();
+
+ // For every (unbound) parameter that the computation wants, we manufacture
+ // some arbitrary data so that we can invoke the computation.
+ std::vector<std::unique_ptr<GlobalData>> fake_arguments;
+ for (const Shape& parameter : program_shape.parameters()) {
+ fake_arguments.push_back(MakeFakeDataOrDie(parameter, client));
+ }
+
+ return fake_arguments;
+}
+
} // namespace xla
#include "tensorflow/compiler/xla/client/client.h"
#include "tensorflow/compiler/xla/client/computation.h"
#include "tensorflow/compiler/xla/client/global_data.h"
+#include "tensorflow/compiler/xla/client/xla_client/xla_computation.h"
#include "tensorflow/compiler/xla/xla_data.pb.h"
namespace xla {
std::vector<std::unique_ptr<GlobalData>> MakeFakeArgumentsOrDie(
const Computation& computation, Client* client);
+// Returns vector of GlobalData handles of fake data (created using
+// MakeFakeDataOrDie) that are correctly shaped arguments for the given
+// xla computation.
+std::vector<std::unique_ptr<GlobalData>> MakeFakeArgumentsOrDie(
+ const XlaComputation& computation, Client* client);
+
} // namespace xla
#endif // TENSORFLOW_COMPILER_XLA_CLIENT_LIB_TESTING_H_