| 77 | } // namespace |
| 78 | |
| 79 | std::unique_ptr<GlobalData> MakeFakeDataOrDie( |
| 80 | const Shape& shape, Client* client, DebugOptions* debug_opts /*=nullptr*/) { |
| 81 | if (DataSizeOfShape(shape) < (1LL << 20)) { |
| 82 | StatusOr<Literal> literal_status = MakeFakeLiteral(shape); |
| 83 | if (!literal_status.ok()) { |
| 84 | // If we got an Unimplemented error, fall back to making the fake data via |
| 85 | // an on-device computation. |
| 86 | CHECK_EQ(literal_status.status().code(), |
| 87 | tensorflow::error::UNIMPLEMENTED); |
| 88 | return MakeFakeDataViaDeviceOrDie(shape, client, debug_opts); |
| 89 | } |
| 90 | return client->TransferToServer(literal_status.ValueOrDie()).ValueOrDie(); |
| 91 | } |
| 92 | |
| 93 | // If the data is large, generate it on-device. |
| 94 | return MakeFakeDataViaDeviceOrDie(shape, client, debug_opts); |
| 95 | } |
| 96 | |
| 97 | std::vector<std::unique_ptr<GlobalData>> MakeFakeArgumentsOrDie( |
| 98 | const XlaComputation& computation, Client* client, |
no test coverage detected