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

Method ByteSizeOf

tensorflow/compiler/xla/shape_util.cc:623–639  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

621}
622
623/* static */ int64 ShapeUtil::ByteSizeOf(const Shape& shape,
624 int64 pointer_size) {
625 TF_DCHECK_OK(ValidateShape(shape));
626 if (shape.element_type() == TUPLE) {
627 return ByteSizeOfTupleIndexTable(shape, pointer_size);
628 } else if (shape.IsArray()) {
629 int64 byte_size = ByteSizeOfElements(shape);
630 return byte_size;
631 } else if (shape.element_type() == TOKEN) {
632 return 0;
633 } else if (shape.element_type() == OPAQUE_TYPE) {
634 CHECK_GT(pointer_size, 0);
635 return pointer_size;
636 }
637 LOG(FATAL) << PrimitiveType_Name(shape.element_type())
638 << " primitive type has no definitive size";
639}
640
641/* static */ int64 ShapeUtil::ByteSizeOfTupleIndexTable(const Shape& shape,
642 int64 pointer_size) {

Callers

nothing calls this directly

Calls 3

ValidateShapeFunction · 0.85
element_typeMethod · 0.45
IsArrayMethod · 0.45

Tested by

no test coverage detected