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

Method ToProto

tensorflow/compiler/xla/shape.cc:58–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58ShapeProto Shape::ToProto() const {
59 ShapeProto proto;
60 proto.set_element_type(element_type_);
61 proto.mutable_dimensions()->Reserve(dimensions_size());
62 for (const int64 dimension : dimensions()) {
63 proto.add_dimensions(dimension);
64 }
65 for (const bool dynamic : dynamic_dimensions_) {
66 proto.add_is_dynamic_dimension(dynamic);
67 }
68 proto.mutable_tuple_shapes()->Reserve(tuple_shapes_size());
69 for (const Shape& shape : tuple_shapes()) {
70 *proto.add_tuple_shapes() = shape.ToProto();
71 }
72 if (has_layout()) {
73 *proto.mutable_layout() = layout().ToProto();
74 }
75 return proto;
76}
77
78string Shape::ToString(bool print_layout) const {
79 if (print_layout) {

Callers 15

RunGraphAsyncMethod · 0.45
FromLiteralMethod · 0.45
CompileMethod · 0.45
ComputeMethod · 0.45
ComputeMethod · 0.45
TwoElementTupleFunction · 0.45
BasedTwoElementTupleFunction · 0.45
ScalarLiteralFunction · 0.45
NestedTupleFunction · 0.45
MakeTuple0Function · 0.45
FloatVectorFunction · 0.45

Calls 10

set_element_typeMethod · 0.80
mutable_dimensionsMethod · 0.80
add_dimensionsMethod · 0.80
mutable_tuple_shapesMethod · 0.80
add_tuple_shapesMethod · 0.80
mutable_layoutMethod · 0.80
add_parametersMethod · 0.80
mutable_resultMethod · 0.80
add_parameter_namesMethod · 0.80
ReserveMethod · 0.45

Tested by 15

TwoElementTupleFunction · 0.36
BasedTwoElementTupleFunction · 0.36
ScalarLiteralFunction · 0.36
NestedTupleFunction · 0.36
MakeTuple0Function · 0.36
FloatVectorFunction · 0.36
FloatMatrixFunction · 0.36
CompareLiteralsFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36
TESTFunction · 0.36