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

Function DataSizeOfShape

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

Calculates the number of bytes required to store the data within the specified shape. In case of a (nested) tuple shape this is the total byte size of all sub-shapes within the tuple.

Source from the content-addressed store, hash-verified

34// specified shape. In case of a (nested) tuple shape this is the total byte
35// size of all sub-shapes within the tuple.
36int64 DataSizeOfShape(const Shape& shape) {
37 if (shape.IsArray()) {
38 return ShapeUtil::ByteSizeOf(shape);
39 }
40
41 int64 total_size = 0;
42 for (const Shape& s : shape.tuple_shapes()) {
43 total_size += DataSizeOfShape(s);
44 }
45 return total_size;
46}
47
48// Creates a XlaOp for an op what generates fake data with the given shape.
49XlaOp BuildFakeDataOpOnDevice(const Shape& shape, XlaBuilder* builder) {

Callers 1

MakeFakeDataOrDieFunction · 0.85

Calls 3

ByteSizeOfFunction · 0.50
IsArrayMethod · 0.45
tuple_shapesMethod · 0.45

Tested by

no test coverage detected