aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/compiler/xla/layout_util.cc
diff options
context:
space:
mode:
authorGravatar Justin Lebar <jlebar@google.com>2018-08-27 14:50:49 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-08-27 14:55:29 -0700
commitd57f5a82025702d573d478091dc9c385adf53c09 (patch)
treee0a9f6b00cd6846cf71a79e02779e1e1f1f9cfc5 /tensorflow/compiler/xla/layout_util.cc
parent91f33732cb15f51eaf6ec86c82e42a74e351e061 (diff)
[XLA] Switch to absl::StrFormat.
Unlike Printf, StrFormat does not require type-length qualifiers, e.g %z, %ll. Nor does it require that you call c_str() to print strings. So these are fixed up here as well. PiperOrigin-RevId: 210435915
Diffstat (limited to 'tensorflow/compiler/xla/layout_util.cc')
-rw-r--r--tensorflow/compiler/xla/layout_util.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/tensorflow/compiler/xla/layout_util.cc b/tensorflow/compiler/xla/layout_util.cc
index 61c26434b1..cce1838ef3 100644
--- a/tensorflow/compiler/xla/layout_util.cc
+++ b/tensorflow/compiler/xla/layout_util.cc
@@ -169,7 +169,7 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
} else if (ShapeUtil::IsArray(shape)) {
if (!shape.has_layout()) {
return InvalidArgument("shape %s does not have a layout",
- ShapeUtil::HumanString(shape).c_str());
+ ShapeUtil::HumanString(shape));
}
return ValidateLayoutForShape(shape.layout(), shape);
} else {
@@ -177,7 +177,7 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
if (shape.has_layout()) {
return InvalidArgument(
"shape of primitive type %s should not have a layout",
- PrimitiveType_Name(shape.element_type()).c_str());
+ PrimitiveType_Name(shape.element_type()));
}
return Status::OK();
}
@@ -194,7 +194,7 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
layout.padded_dimensions_size() != 0) {
return InvalidArgument(
"shape of primitive type %s should not have a non-trivial layout",
- PrimitiveType_Name(shape.element_type()).c_str());
+ PrimitiveType_Name(shape.element_type()));
}
return Status::OK();
}
@@ -202,17 +202,17 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
if (layout.format() == INVALID_FORMAT) {
return InvalidArgument(
"Layout does not have a valid format: layout {%s}, shape {%s}",
- layout.ShortDebugString().c_str(), shape.ShortDebugString().c_str());
+ layout.ShortDebugString(), shape.ShortDebugString());
}
if (layout.format() == DENSE) {
if (layout.minor_to_major_size() != ShapeUtil::Rank(shape)) {
return InvalidArgument(
"layout minor_to_major field contains %d elements, "
- "but shape is rank %lld: {%s}; shape: %s",
+ "but shape is rank %d: {%s}; shape: %s",
layout.minor_to_major_size(), ShapeUtil::Rank(shape),
- absl::StrJoin(layout.minor_to_major(), ", ").c_str(),
- shape.ShortDebugString().c_str());
+ absl::StrJoin(layout.minor_to_major(), ", "),
+ shape.ShortDebugString());
}
std::vector<bool> dimensions_in_layout(ShapeUtil::Rank(shape), false);
@@ -221,12 +221,12 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
if (dim < 0 || dim >= ShapeUtil::Rank(shape)) {
return InvalidArgument(
"layout minor_to_major field has out-of-bounds value: %s",
- HumanString(layout).c_str());
+ HumanString(layout));
}
if (dimensions_in_layout[dim]) {
return InvalidArgument(
"layout minor_to_major field has duplicate values: {%s}",
- HumanString(layout).c_str());
+ HumanString(layout));
}
dimensions_in_layout[dim] = true;
}
@@ -234,14 +234,14 @@ Layout CreateDefaultLayoutForRank(int64 rank) {
if (layout.padded_dimensions_size() > 0) {
if (layout.padded_dimensions_size() != ShapeUtil::Rank(shape)) {
return InvalidArgument(
- "layout has %d padded dimensions, but shape is rank %lld",
+ "layout has %d padded dimensions, but shape is rank %d",
layout.padded_dimensions_size(), ShapeUtil::Rank(shape));
}
for (int i = 0; i < layout.padded_dimensions_size(); ++i) {
if (layout.padded_dimensions(i) < shape.dimensions(i)) {
return InvalidArgument(
- "for dimension %d, dimension padding (%lld) is smaller than "
- "the dimension size (%lld) of the shape",
+ "for dimension %d, dimension padding (%d) is smaller than "
+ "the dimension size (%d) of the shape",
i, layout.padded_dimensions(i), shape.dimensions(i));
}
}