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
This commit is contained in:
Jeffrey A. Dean 2020-07-22 10:21:35 -07:00 committed by TensorFlower Gardener
parent a1cec7e442
commit 177790aafc

View File

@ -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();
}