Skip to content

Commit 43b502c

Browse files
tkoeppetensorflower-gardener
authored andcommitted
Replace NULL and 0 with nullptr.
PiperOrigin-RevId: 426918958 Change-Id: Ie96507133705eed6bf8519440ed4bd595b9b83ae
1 parent d9e5d3c commit 43b502c

11 files changed

Lines changed: 15 additions & 15 deletions

File tree

tensorflow/core/common_runtime/graph_constructor_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3232,7 +3232,7 @@ TEST_F(GraphConstructorTest, ImportGraphDef_ValidateDefaultDevice) {
32323232
options.default_device = "/gpu:13";
32333233
ImportGraphDefResults res;
32343234

3235-
TF_ASSERT_OK(ImportGraphDef(options, gdef, &graph_, NULL, &res));
3235+
TF_ASSERT_OK(ImportGraphDef(options, gdef, &graph_, nullptr, &res));
32363236
std::map<string, string> node2dev;
32373237
for (Node* n : graph_.nodes()) {
32383238
node2dev[n->name()] = n->requested_device();

tensorflow/core/kernels/eigen_attention.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ struct GlimpseExtractionOp {
193193
.template cast<float>();
194194

195195
DSizes<Index, 3> glimpse_size(num_channels, width_, height_);
196-
TensorMap<Tensor<float, 3> > tmp(NULL, glimpse_size);
196+
TensorMap<Tensor<float, 3> > tmp(nullptr, glimpse_size);
197197
output.template chip<3>(i).device(device) =
198198
mini.reshape(Sizes<1, 1, 1>()).broadcast(glimpse_size) +
199199
(tmp.random(unigen) *
@@ -231,7 +231,7 @@ struct GlimpseExtractionOp {
231231
maxi.device(device) =
232232
input.template chip<3>(i).template chip<0>(j).maximum();
233233

234-
TensorMap<Tensor<float, 2> > tmp(NULL, glimpse_size);
234+
TensorMap<Tensor<float, 2> > tmp(nullptr, glimpse_size);
235235
output.template chip<3>(i).template chip<0>(j).device(device) =
236236
(mean.reshape(Sizes<1, 1>()).broadcast(glimpse_size) +
237237
(tmp.random(gen) *

tensorflow/core/lib/gtl/map_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const typename Collection::value_type::second_type* FindOrNull(
4040
const typename Collection::value_type::first_type& key) {
4141
typename Collection::const_iterator it = collection.find(key);
4242
if (it == collection.end()) {
43-
return 0;
43+
return nullptr;
4444
}
4545
return &it->second;
4646
}
@@ -52,7 +52,7 @@ typename Collection::value_type::second_type* FindOrNull(
5252
const typename Collection::value_type::first_type& key) {
5353
typename Collection::iterator it = collection.find(key);
5454
if (it == collection.end()) {
55-
return 0;
55+
return nullptr;
5656
}
5757
return &it->second;
5858
}

tensorflow/core/lib/io/table.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Iterator* Table::BlockReader(void* arg, const StringPiece& index_value) {
104104
Table* table = reinterpret_cast<Table*>(arg);
105105
Cache* block_cache = table->rep_->options.block_cache;
106106
Block* block = nullptr;
107-
Cache::Handle* cache_handle = NULL;
107+
Cache::Handle* cache_handle = nullptr;
108108

109109
BlockHandle handle;
110110
StringPiece input = index_value;

tensorflow/core/lib/png/png_io.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct DecodeContext {
5656
int channels;
5757
bool need_to_synthesize_16;
5858
bool error_condition;
59-
DecodeContext() : png_ptr(NULL), info_ptr(NULL) {}
59+
DecodeContext() : png_ptr(nullptr), info_ptr(nullptr) {}
6060
};
6161

6262
bool DecodeHeader(StringPiece png_string, int* width, int* height,

tensorflow/core/profiler/internal/gpu/cupti_collector.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class PerDeviceCollector {
114114

115115
status = cudaOccMaxPotentialOccupancyBlockSize(
116116
&stats.min_grid_size, &stats.suggested_block_size, &device_properties_,
117-
&params.attributes, &state, NULL, params.dynamic_smem_size);
117+
&params.attributes, &state, nullptr, params.dynamic_smem_size);
118118
if (status != CUDA_OCC_SUCCESS) {
119119
return {};
120120
}

tensorflow/core/profiler/internal/gpu/cupti_tracer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ class CuptiDriverApiHookWithActivityApi : public CuptiDriverApiHook {
850850
private:
851851
void TrackContext(CUpti_CallbackId cbid, CUcontext ctx) {
852852
if (!option_.sync_devices_before_stop) return;
853-
if (ctx == NULL) return;
853+
if (ctx == nullptr) return;
854854
absl::MutexLock lock(&mutex_);
855855
if (cbid == CUPTI_DRIVER_TRACE_CBID_cuCtxDestroy_v2 ||
856856
cbid == CUPTI_DRIVER_TRACE_CBID_cuCtxDestroy) {

tensorflow/core/profiler/internal/gpu/device_tracer_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ TEST_F(DeviceTracerTest, CudaRuntimeResource) {
331331
const size_t size_in_bytes = 8;
332332
const int8_t test_value = 7;
333333
TF_EXPECT_OK(tracer->Start());
334-
void* hostptr = 0;
335-
void* devptr = 0;
334+
void* hostptr = nullptr;
335+
void* devptr = nullptr;
336336

337337
// These six CUDA API calls will create 4 CUDA API and 4 device XEvents.
338338
ASSERT_EQ(cudaSuccess,

tensorflow/java/src/main/native/eager_operation_builder_jni.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ JNIEXPORT void JNICALL Java_org_tensorflow_EagerOperationBuilder_delete(
9191
JNIEXPORT jlongArray JNICALL Java_org_tensorflow_EagerOperationBuilder_execute(
9292
JNIEnv* env, jclass clazz, jlong op_handle) {
9393
TFE_Op* op = requireOp(env, op_handle);
94-
if (op == nullptr) return 0;
94+
if (op == nullptr) return nullptr;
9595
int num_retvals = MAX_OUTPUTS_PER_OP;
9696
std::unique_ptr<TFE_TensorHandle*[]> retvals(
9797
new TFE_TensorHandle*[num_retvals]);

tensorflow/java/src/main/native/graph_jni.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ jlongArray buildSubgraph(JNIEnv* env, jclass clazz, jobject subgraph_builder,
206206
jmethodID build_subgraph_method_id = env->GetStaticMethodID(
207207
clazz, "buildSubgraph",
208208
"(Lorg/tensorflow/Graph$WhileSubgraphBuilder;J[J[I[J[I)[J");
209-
if (build_subgraph_method_id == 0) return nullptr;
209+
if (build_subgraph_method_id == nullptr) return nullptr;
210210

211211
jlong subgraph_handle = reinterpret_cast<jlong>(subgraph);
212212

@@ -309,7 +309,7 @@ JNIEXPORT jlongArray JNICALL Java_org_tensorflow_Graph_whileLoop(
309309
body_output_elems, 0);
310310

311311
// set loop name param
312-
params.name = env->GetStringUTFChars(name, 0);
312+
params.name = env->GetStringUTFChars(name, nullptr);
313313

314314
// build the while loop, storing loop outputs in `outputs`
315315
std::unique_ptr<TF_Output[]> outputs(new TF_Output[ninputs]);

0 commit comments

Comments
 (0)