Creates a XlaOp for an op what generates fake data with the given shape.
| 47 | |
| 48 | // Creates a XlaOp for an op what generates fake data with the given shape. |
| 49 | XlaOp BuildFakeDataOpOnDevice(const Shape& shape, XlaBuilder* builder) { |
| 50 | if (shape.IsArray()) { |
| 51 | return Broadcast( |
| 52 | ConstantLiteral(builder, LiteralUtil::One(shape.element_type())), |
| 53 | AsInt64Slice(shape.dimensions())); |
| 54 | } |
| 55 | std::vector<XlaOp> parts; |
| 56 | for (const Shape& s : shape.tuple_shapes()) { |
| 57 | parts.push_back(BuildFakeDataOpOnDevice(s, builder)); |
| 58 | } |
| 59 | return Tuple(builder, parts); |
| 60 | } |
| 61 | |
| 62 | std::unique_ptr<GlobalData> MakeFakeDataViaDeviceOrDie( |
| 63 | const Shape& shape, Client* client, DebugOptions* debug_opts) { |
no test coverage detected