From 177790aafca2d550ffbbf2efcc541ff0b20298d1 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Dean" Date: Wed, 22 Jul 2020 10:21:35 -0700 Subject: [PATCH] Turn relatively expensive CHECK on Shape::rank() into a DCHECK. Eliminates 2.6% of compilation time in profiling one compile-intensive workload. PiperOrigin-RevId: 322601531 Change-Id: I8786323b318d54cdaf9baaea318a7abf4bccdd59 --- tensorflow/compiler/xla/shape.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorflow/compiler/xla/shape.h b/tensorflow/compiler/xla/shape.h index dfaac677724..6a19a1fac09 100644 --- a/tensorflow/compiler/xla/shape.h +++ b/tensorflow/compiler/xla/shape.h @@ -49,7 +49,7 @@ class Shape { // Returns the rank (number of dimensions) of the given shape. Shape must be // an array. int64 rank() const { - CHECK(IsArray()) << "Non-arrays do not have a rank, shape: " << ToString(); + DCHECK(IsArray()) << "Non-arrays do not have a rank, shape: " << ToString(); return dimensions_.size(); }