Minor cleanup: Add braces around if statement arms; remove redundant "return" and "static".

PiperOrigin-RevId: 158143418
This commit is contained in:
A. Unique TensorFlower 2017-06-06 08:29:27 -07:00 committed by TensorFlower Gardener
parent e9a889c5ed
commit 61c8a745ba
7 changed files with 37 additions and 25 deletions

View File

@ -1237,7 +1237,9 @@ Status AlgebraicSimplifierVisitor::HandleConvolution(
// bitcasts_ == true.
// TODO(cwhipkey): b/31337498, make this layout insensitive.
if (!is_layout_sensitive_) return Status::OK();
if (!is_layout_sensitive_) {
return Status::OK();
}
const ConvolutionDimensionNumbers& dnums =
convolution->convolution_dimension_numbers();

View File

@ -222,7 +222,9 @@ const Eigen::ThreadPoolDevice* Backend::eigen_intra_op_thread_pool_device()
}
tensorflow::thread::ThreadPool* Backend::eigen_intra_op_thread_pool() const {
if (intra_op_thread_pool_wrapper_ == nullptr) return nullptr;
if (intra_op_thread_pool_wrapper_ == nullptr) {
return nullptr;
}
return intra_op_thread_pool_wrapper_->pool.get();
}

View File

@ -164,7 +164,6 @@ void ComputationTracker::ComputeComputationPostOrder(
visited->insert(versioned_handle);
post_order->push_back(versioned_handle);
return;
}
StatusOr<std::unique_ptr<HloModule>> ComputationTracker::BuildHloModule(

View File

@ -498,7 +498,9 @@ bool HloComputation::operator==(const HloComputation& other) const {
// If <a,b> are visited but not identical, the recursion should have
// been aborted. So, if <a,b> are visited at this point, they must be
// identical.
if (visited.count(std::make_pair(a, b)) > 0) return true;
if (visited.count(std::make_pair(a, b)) > 0) {
return true;
}
visited.emplace(a, b);
return a->Identical(
*b, eq, [](const HloComputation* a, const HloComputation* b) {

View File

@ -1445,7 +1445,9 @@ string HloInstruction::ToString(bool compact_operands,
// Concatenate elements in "v" with spaces separating them, but ignoring
// empty entries.
for (const auto& s : v) {
if (s.empty()) continue;
if (s.empty()) {
continue;
}
StrAppend(&operands, (first ? "" : " "), s);
first = false;
}
@ -2183,13 +2185,14 @@ HloInstruction::UseKind HloInstruction::OperandElementUse(int64 i) const {
std::function<UseKind(const HloInstruction&)> reuses_parameter_elements =
[i, &cache, &reuses_parameter_elements](const HloInstruction& hlo) {
auto plus = [](const UseKind& a, const UseKind& b) {
if (a == UseKind::kNoUse) return b;
if (b == UseKind::kNoUse) return a;
if (a == UseKind::kReuse || b == UseKind::kReuse) {
if (a == UseKind::kNoUse) {
return b;
} else if (b == UseKind::kNoUse) {
return a;
} else if (a == UseKind::kReuse || b == UseKind::kReuse) {
return UseKind::kReuse;
}
if (a == UseKind::kUsePermutingElements ||
b == UseKind::kUsePermutingElements) {
} else if (a == UseKind::kUsePermutingElements ||
b == UseKind::kUsePermutingElements) {
return UseKind::kReuse;
}
CHECK(UseKind::kUse == a && UseKind::kUse == b);

View File

@ -489,26 +489,30 @@ class BenchmarkType {
// Calibrate the amount of time spent just calling DoWork, since each of our
// tests will do this, we can subtract this out of benchmark results.
static void BM_CalibrateWorkLoop(int iters) {
void BM_CalibrateWorkLoop(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
BenchmarkType* result = factory.TrivialFactory();
tensorflow::testing::StartTiming();
for (int i = 0; i != iters; ++i) {
if (result != nullptr) result->DoWork();
if (result != nullptr) {
result->DoWork();
}
}
}
BENCHMARK(BM_CalibrateWorkLoop);
// Measure the time taken to call into the factory, return the value,
// determine that it is OK, and invoke a trivial function.
static void BM_TrivialFactory(int iters) {
void BM_TrivialFactory(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
for (int i = 0; i != iters; ++i) {
BenchmarkType* result = factory.TrivialFactory();
if (result != nullptr) result->DoWork();
if (result != nullptr) {
result->DoWork();
}
}
}
BENCHMARK(BM_TrivialFactory);
@ -516,7 +520,7 @@ BENCHMARK(BM_TrivialFactory);
// Measure the time taken to call into the factory, providing an
// out-param for the result, evaluating the status result and the
// result pointer, and invoking the trivial function.
static void BM_ArgumentFactory(int iters) {
void BM_ArgumentFactory(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -532,7 +536,7 @@ BENCHMARK(BM_ArgumentFactory);
// Measure the time to use the StatusOr<T*> factory, evaluate the result,
// and invoke the trivial function.
static void BM_StatusOrFactory(int iters) {
void BM_StatusOrFactory(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -548,7 +552,7 @@ BENCHMARK(BM_StatusOrFactory);
// Measure the time taken to call into the factory, providing an
// out-param for the result, evaluating the status result and the
// result pointer, and invoking the trivial function.
static void BM_ArgumentFactoryFail(int iters) {
void BM_ArgumentFactoryFail(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -564,7 +568,7 @@ BENCHMARK(BM_ArgumentFactoryFail);
// Measure the time to use the StatusOr<T*> factory, evaluate the result,
// and invoke the trivial function.
static void BM_StatusOrFactoryFail(int iters) {
void BM_StatusOrFactoryFail(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -580,7 +584,7 @@ BENCHMARK(BM_StatusOrFactoryFail);
// Measure the time taken to call into the factory, providing an
// out-param for the result, evaluating the status result and the
// result pointer, and invoking the trivial function.
static void BM_ArgumentFactoryFailShortMsg(int iters) {
void BM_ArgumentFactoryFailShortMsg(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -596,7 +600,7 @@ BENCHMARK(BM_ArgumentFactoryFailShortMsg);
// Measure the time to use the StatusOr<T*> factory, evaluate the result,
// and invoke the trivial function.
static void BM_StatusOrFactoryFailShortMsg(int iters) {
void BM_StatusOrFactoryFailShortMsg(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -612,7 +616,7 @@ BENCHMARK(BM_StatusOrFactoryFailShortMsg);
// Measure the time taken to call into the factory, providing an
// out-param for the result, evaluating the status result and the
// result pointer, and invoking the trivial function.
static void BM_ArgumentFactoryFailLongMsg(int iters) {
void BM_ArgumentFactoryFailLongMsg(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();
@ -628,7 +632,7 @@ BENCHMARK(BM_ArgumentFactoryFailLongMsg);
// Measure the time to use the StatusOr<T*> factory, evaluate the result,
// and invoke the trivial function.
static void BM_StatusOrFactoryFailLongMsg(int iters) {
void BM_StatusOrFactoryFailLongMsg(int iters) {
tensorflow::testing::StopTiming();
BenchmarkFactory<BenchmarkType> factory;
tensorflow::testing::StartTiming();

View File

@ -127,8 +127,9 @@ class SplitVOpBase : public OpKernel {
"specified. Got: ",
determined_size));
if (neg_one_dim >= 0)
if (neg_one_dim >= 0) {
(*split_sizes_vec)[neg_one_dim] = input_size_split_dim - determined_size;
}
// Special case 2: split along the 1st dimension. We can share the
// underlying buffer.
@ -148,7 +149,6 @@ class SplitVOpBase : public OpKernel {
*done = true;
return;
}
return;
}
template <typename IndexType>