Skip to content

Commit 9f96c91

Browse files
rjpowertensorflower-gardener
authored andcommitted
Apply ClangTidy fixes to TF codebase.
PiperOrigin-RevId: 538642169
1 parent cf2df9d commit 9f96c91

45 files changed

Lines changed: 103 additions & 28 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

tensorflow/compiler/aot/tests/tfcompile_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include <algorithm>
17+
#include <vector>
1618
#define EIGEN_USE_THREADS
1719
#define EIGEN_USE_CUSTOM_THREAD_POOL
1820

tensorflow/compiler/tests/randomized_tests.cc

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,19 @@ limitations under the License.
4343
// * StridedSliceGrad (need to use shape function to compute sensible inputs)
4444

4545
#include <algorithm>
46+
#include <array>
47+
#include <cmath>
48+
#include <functional>
49+
#include <iterator>
50+
#include <limits>
51+
#include <memory>
52+
#include <numeric>
53+
#include <optional>
4654
#include <random>
55+
#include <string>
4756
#include <unordered_map>
57+
#include <utility>
58+
#include <vector>
4859

4960
#include "absl/algorithm/container.h"
5061
#include "absl/container/flat_hash_set.h"
@@ -504,7 +515,7 @@ OpTest::OpTest() {
504515
<< ". To reproduce the "
505516
"results of this test, pass flag --tf_xla_random_seed="
506517
<< seed;
507-
generator_.reset(new std::mt19937(seed));
518+
generator_ = std::make_unique<std::mt19937>(seed);
508519
}
509520

510521
namespace {
@@ -532,7 +543,7 @@ template <typename T>
532543
class TensorGenerator {
533544
public:
534545
explicit TensorGenerator(OpTest& test) : test_(test) {}
535-
virtual ~TensorGenerator() {}
546+
virtual ~TensorGenerator() = default;
536547
virtual DataType dtype() = 0;
537548
virtual void RandomVals(std::optional<T> lo, std::optional<T> hi,
538549
bool needs_unique_values,

tensorflow/compiler/tf2tensorrt/common/utils.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ limitations under the License.
1515

1616
#include "tensorflow/compiler/tf2tensorrt/common/utils.h"
1717

18+
#include <tuple>
19+
1820
#if GOOGLE_CUDA && GOOGLE_TENSORRT
1921
#include "absl/base/call_once.h"
2022
#include "absl/strings/str_cat.h"

tensorflow/compiler/xrt/ops/xrt_execute_op.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include <vector>
17+
1618
#include "tensorflow/core/framework/common_shape_fns.h"
1719
#include "tensorflow/core/framework/op.h"
1820
#include "tensorflow/core/framework/shape_inference.h"

tensorflow/compiler/xrt/tests/raw_api_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include <functional>
1617
#include <memory>
1718
#include <string>
19+
#include <utility>
1820
#include <vector>
1921

2022
#include "absl/strings/str_cat.h"

tensorflow/core/activity_watcher/activity.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ limitations under the License.
1515

1616
#include "tensorflow/core/activity_watcher/activity.h"
1717

18+
#include <atomic>
1819
#include <memory>
1920

2021
namespace tensorflow {

tensorflow/core/config/flags_api_wrapper.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
1515

16+
#include <memory>
1617
#include <string>
1718

1819
#include "absl/types/optional.h"

tensorflow/core/data/service/snapshot/snapshot_split_provider_test.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,10 @@ SnapshotTaskDef TestSnapshotTask() {
7575
}
7676

7777
Status WriteSplits(const SnapshotTaskDef& snapshot_task, int64_t num_splits) {
78-
std::string source_dir = RepetitionDirectory(
79-
snapshot_task.base_path(), snapshot_task.stream_index(), /*source_id=*/0,
80-
/*repetition_index=*/0);
78+
std::string source_dir =
79+
RepetitionDirectory(snapshot_task.base_path(),
80+
snapshot_task.stream_index(), /*source_index=*/0,
81+
/*repetition_index=*/0);
8182
TF_RETURN_IF_ERROR(Env::Default()->RecursivelyCreateDir(source_dir));
8283
for (int64_t i = 0; i < num_splits; ++i) {
8384
std::string split_filename = absl::StrCat("split_", i, "_", i);

tensorflow/core/ir/importexport/tests/roundtrip/roundtrip.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ limitations under the License.
1616
#include "tensorflow/core/ir/importexport/tests/roundtrip/roundtrip.h"
1717

1818
#include <algorithm>
19+
#include <cmath>
1920

2021
#include "llvm/ADT/STLExtras.h"
2122
#include "llvm/ADT/SmallVector.h"

tensorflow/core/ir/importexport/tests/saved_model/saved_model_roundtrip_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ void RunRoundTrip(const std::string& input_file) {
5353
auto status = mlir::tfg::ExportMlirToSavedModel(*module_ref, original_model,
5454
&final_model);
5555
if (!status.ok()) {
56-
LOG(ERROR) << "Export failed: " << status.ToString();
56+
LOG(ERROR) << "Export failed: " << status;
5757
}
58-
ASSERT_TRUE(status.ok()) << status.ToString();
58+
ASSERT_TRUE(status.ok()) << status;
5959

6060
tensorflow::MetaGraphDef* original_metagraph =
6161
original_model.mutable_meta_graphs(0);

0 commit comments

Comments
 (0)