Skip to content

Commit

Permalink
[XLA] Produce fake args using one computation, not N.
Browse files Browse the repository at this point in the history
This is much faster to compile.

PiperOrigin-RevId: 207577415
  • Loading branch information
Justin Lebar authored and tensorflower-gardener committed Aug 6, 2018
1 parent 915cf10 commit 29639b8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tensorflow/compiler/xla/client/lib/testing.cc
Expand Up @@ -98,14 +98,13 @@ std::vector<std::unique_ptr<GlobalData>> MakeFakeArgumentsOrDie(
<< "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;
// Create and run a program which produces a tuple with one element per
// parameter, then return the tuple's constituent buffers.
std::vector<Shape> param_shapes(program_shape.parameters().begin(),
program_shape.parameters().end());
auto fake_input_tuple =
MakeFakeDataOrDie(ShapeUtil::MakeTupleShape(param_shapes), client);
return client->DeconstructTuple(*fake_input_tuple).ValueOrDie();
}

} // namespace xla

0 comments on commit 29639b8

Please sign in to comment.