MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / BuildFakeDataOpOnDevice

Function BuildFakeDataOpOnDevice

tensorflow/compiler/xla/client/lib/testing.cc:49–60  ·  view source on GitHub ↗

Creates a XlaOp for an op what generates fake data with the given shape.

Source from the content-addressed store, hash-verified

47
48// Creates a XlaOp for an op what generates fake data with the given shape.
49XlaOp 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
62std::unique_ptr<GlobalData> MakeFakeDataViaDeviceOrDie(
63 const Shape& shape, Client* client, DebugOptions* debug_opts) {

Callers 1

Calls 10

BroadcastFunction · 0.85
ConstantLiteralFunction · 0.85
OneFunction · 0.70
AsInt64SliceFunction · 0.50
TupleFunction · 0.50
IsArrayMethod · 0.45
element_typeMethod · 0.45
dimensionsMethod · 0.45
tuple_shapesMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected