Add const qualifiers whenever appropriate.

PiperOrigin-RevId: 168465926
This commit is contained in:
Henry Tan 2017-09-12 16:24:31 -07:00 committed by TensorFlower Gardener
parent bf96fcd13a
commit c728665ec3

View File

@ -93,7 +93,7 @@ Status AddImages(const string& tag, int max_images, int batch_size, int w,
v->set_tag(strings::StrCat(tag, "/image")); v->set_tag(strings::StrCat(tag, "/image"));
} }
auto image = ith_image(i); const auto image = ith_image(i);
Summary::Image* si = v->mutable_image(); Summary::Image* si = v->mutable_image();
si->set_height(h); si->set_height(h);
si->set_width(w); si->set_width(w);
@ -154,7 +154,7 @@ void NormalizeFloatImage(int hw, int depth,
const float kZeroThreshold = 1e-6; const float kZeroThreshold = 1e-6;
T scale, offset; T scale, offset;
if (image_min < 0) { if (image_min < 0) {
float max_val = std::max(std::abs(image_min), std::abs(image_max)); const float max_val = std::max(std::abs(image_min), std::abs(image_max));
scale = T(max_val < kZeroThreshold ? 0.0f : 127.0f / max_val); scale = T(max_val < kZeroThreshold ? 0.0f : 127.0f / max_val);
offset = T(128.0f); offset = T(128.0f);
} else { } else {
@ -217,7 +217,7 @@ class SummaryWriterImpl : public SummaryWriterInterface {
Status Initialize(const string& logdir, const string& filename_suffix, Status Initialize(const string& logdir, const string& filename_suffix,
Env* env) { Env* env) {
Status is_dir = env->IsDirectory(logdir); const Status is_dir = env->IsDirectory(logdir);
if (!is_dir.ok()) { if (!is_dir.ok()) {
if (is_dir.code() != tensorflow::error::NOT_FOUND) { if (is_dir.code() != tensorflow::error::NOT_FOUND) {
return is_dir; return is_dir;
@ -419,7 +419,7 @@ Status CreateSummaryWriter(int max_queue, int flush_millis,
const string& logdir, const string& filename_suffix, const string& logdir, const string& filename_suffix,
Env* env, SummaryWriterInterface** result) { Env* env, SummaryWriterInterface** result) {
SummaryWriterImpl* w = new SummaryWriterImpl(max_queue, flush_millis); SummaryWriterImpl* w = new SummaryWriterImpl(max_queue, flush_millis);
Status s = w->Initialize(logdir, filename_suffix, env); const Status s = w->Initialize(logdir, filename_suffix, env);
if (!s.ok()) { if (!s.ok()) {
w->Unref(); w->Unref();
*result = nullptr; *result = nullptr;