aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Patrick Nguyen <drpng@google.com>2017-06-19 10:27:47 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-06-19 10:31:41 -0700
commitaffc8b084284125ac366d53b63dda7f57eb2d12a (patch)
treeffa4ae0aaccaf21322aa6a3ec942b049f11be8af
parent5479240a00e904b0f05fa4ae3760cb4deedb864c (diff)
Fix warnings.
Fixes #9138. * lstm_ops: use_peephole checked twice, merged "if" bodies. * unpack_path_op: cast to 1LL for shift to operate on full range. * sample_input_ops: add CHECK to ensure that sparse_input_start is initialized. * function: make sure we deref "e" after checking for nullptr * master_session: remove unused variable * encode_jpeg_op: remove double assignment * resize_area_op: use unused variable * strcat: remove double parentheses PiperOrigin-RevId: 159443547
-rw-r--r--tensorflow/contrib/rnn/kernels/lstm_ops.h3
-rw-r--r--tensorflow/contrib/tensor_forest/hybrid/core/ops/unpack_path_op.cc2
-rw-r--r--tensorflow/contrib/tensor_forest/kernels/sample_inputs_op.cc2
-rw-r--r--tensorflow/core/common_runtime/function.cc6
-rw-r--r--tensorflow/core/distributed_runtime/master_session.cc2
-rw-r--r--tensorflow/core/kernels/encode_jpeg_op.cc2
-rw-r--r--tensorflow/core/kernels/resize_area_op.cc5
-rw-r--r--tensorflow/core/lib/strings/strcat.cc2
8 files changed, 10 insertions, 14 deletions
diff --git a/tensorflow/contrib/rnn/kernels/lstm_ops.h b/tensorflow/contrib/rnn/kernels/lstm_ops.h
index d9ed9e3ab7..6317f32ac3 100644
--- a/tensorflow/contrib/rnn/kernels/lstm_ops.h
+++ b/tensorflow/contrib/rnn/kernels/lstm_ops.h
@@ -279,9 +279,6 @@ struct LSTMBlockCellBprop : public LSTMBlockCell {
cs_prev_grad +
di * wci.reshape(p_shape).broadcast(p_broadcast_shape) +
df * wcf.reshape(p_shape).broadcast(p_broadcast_shape);
- }
-
- if (use_peephole) {
wci_grad.device(d) = (di * cs_prev).sum(Eigen::array<int, 1>({0}));
wcf_grad.device(d) = (df * cs_prev).sum(Eigen::array<int, 1>({0}));
wco_grad.device(d) = (do_ * cs).sum(Eigen::array<int, 1>({0}));
diff --git a/tensorflow/contrib/tensor_forest/hybrid/core/ops/unpack_path_op.cc b/tensorflow/contrib/tensor_forest/hybrid/core/ops/unpack_path_op.cc
index 555674ca69..9d5e1400a5 100644
--- a/tensorflow/contrib/tensor_forest/hybrid/core/ops/unpack_path_op.cc
+++ b/tensorflow/contrib/tensor_forest/hybrid/core/ops/unpack_path_op.cc
@@ -52,7 +52,7 @@ REGISTER_OP("UnpackPath")
auto tree_depth = c->Dim(params, 1);
int64 num_nodes = InferenceContext::kUnknownDim;
if (c->ValueKnown(tree_depth)) {
- num_nodes = (1 << c->Value(tree_depth)) - 1;
+ num_nodes = (static_cast<int64>(1) << c->Value(tree_depth)) - 1;
}
c->set_output(0, c->Matrix(num_points, num_nodes));
diff --git a/tensorflow/contrib/tensor_forest/kernels/sample_inputs_op.cc b/tensorflow/contrib/tensor_forest/kernels/sample_inputs_op.cc
index 6bfc29d96f..3ddc72f216 100644
--- a/tensorflow/contrib/tensor_forest/kernels/sample_inputs_op.cc
+++ b/tensorflow/contrib/tensor_forest/kernels/sample_inputs_op.cc
@@ -284,6 +284,8 @@ class SampleInputs : public OpKernel {
index = rand_feature;
val = inputs(*it, rand_feature);
} else {
+ CHECK(sparse_input) << rand_feature << " selected, and dense is "
+ << input_spec_.dense_features_size();
const auto indices = sparse_input_indices.matrix<int64>();
const auto values = sparse_input_values.vec<float>();
const int32 sparse_index = sparse_input_start + rand_feature -
diff --git a/tensorflow/core/common_runtime/function.cc b/tensorflow/core/common_runtime/function.cc
index 320e214117..b0b834b66a 100644
--- a/tensorflow/core/common_runtime/function.cc
+++ b/tensorflow/core/common_runtime/function.cc
@@ -1047,10 +1047,12 @@ void ToGraphDef(const Graph* g, GraphDef* gdef, bool pretty) {
// to be unique and stable after optimization rewrites. Therefore,
// we use "n<node id>" instead.
for (const Edge* e : inputs) {
- const string srcname = NewName(e->src(), pretty);
if (e == nullptr) {
ndef->add_input("unknown");
- } else if (!e->src()->IsOp()) {
+ continue;
+ }
+ const string srcname = NewName(e->src(), pretty);
+ if (!e->src()->IsOp()) {
} else if (e->IsControlEdge()) {
ndef->add_input(strings::StrCat("^", srcname));
} else if (e->src_output() == 0) {
diff --git a/tensorflow/core/distributed_runtime/master_session.cc b/tensorflow/core/distributed_runtime/master_session.cc
index 94fec4f6d0..c79f68a068 100644
--- a/tensorflow/core/distributed_runtime/master_session.cc
+++ b/tensorflow/core/distributed_runtime/master_session.cc
@@ -1165,7 +1165,6 @@ WorkerCacheInterface* MasterSession::get_worker_cache() const {
Status MasterSession::StartStep(const BuildGraphOptions& opts, int64* count,
ReffedClientGraph** rcg, bool is_partial) {
const uint64 hash = HashBuildGraphOptions(opts);
- ReffedClientGraph* to_unref = nullptr;
{
mutex_lock l(mu_);
// Keep track of how many times this subgraph has been executed in
@@ -1196,7 +1195,6 @@ Status MasterSession::StartStep(const BuildGraphOptions& opts, int64* count,
*rcg = iter->second;
(*rcg)->Ref();
}
- if (to_unref) to_unref->Unref();
return Status::OK();
}
diff --git a/tensorflow/core/kernels/encode_jpeg_op.cc b/tensorflow/core/kernels/encode_jpeg_op.cc
index 8e021b9256..4fcae25aa6 100644
--- a/tensorflow/core/kernels/encode_jpeg_op.cc
+++ b/tensorflow/core/kernels/encode_jpeg_op.cc
@@ -55,8 +55,6 @@ class EncodeJpegOp : public OpKernel {
context, context->GetAttr("optimize_size", &flags_.optimize_jpeg_size));
OP_REQUIRES_OK(context, context->GetAttr("chroma_downsampling",
&flags_.chroma_downsampling));
- OP_REQUIRES_OK(context, context->GetAttr("chroma_downsampling",
- &flags_.chroma_downsampling));
string density_unit;
OP_REQUIRES_OK(context, context->GetAttr("density_unit", &density_unit));
diff --git a/tensorflow/core/kernels/resize_area_op.cc b/tensorflow/core/kernels/resize_area_op.cc
index ad94de89db..ada50dfb70 100644
--- a/tensorflow/core/kernels/resize_area_op.cc
+++ b/tensorflow/core/kernels/resize_area_op.cc
@@ -33,7 +33,6 @@ namespace tensorflow {
typedef Eigen::ThreadPoolDevice CPUDevice;
namespace {
-
struct CachedInterpolation {
int64 start;
int64 end;
@@ -41,7 +40,7 @@ struct CachedInterpolation {
float end_minus_one_scale;
bool needs_bounding;
};
-};
+} // namespace
template <typename Device, typename T>
class ResizeAreaOp : public OpKernel {
@@ -170,7 +169,7 @@ class ResizeAreaOp : public OpKernel {
: (v + 1 > in_x1 ? in_x1 - v : 1.0);
v = ceil(in_x1);
- x_interp.end = ceil(in_x1);
+ x_interp.end = v;
v = x_interp.end - 1;
x_interp.end_minus_one_scale =
v < in_x ? (v + 1 > in_x1 ? st.width_scale : v + 1 - in_x)
diff --git a/tensorflow/core/lib/strings/strcat.cc b/tensorflow/core/lib/strings/strcat.cc
index 3e864c4f28..46a45a6678 100644
--- a/tensorflow/core/lib/strings/strcat.cc
+++ b/tensorflow/core/lib/strings/strcat.cc
@@ -38,7 +38,7 @@ AlphaNum::AlphaNum(Hex hex) {
// We accomplish minimum width by OR'ing in 0x10000 to the user's value,
// where 0x10000 is the smallest hex number that is as wide as the user
// asked for.
- uint64 mask = ((static_cast<uint64>(1) << (width - 1) * 4)) | value;
+ uint64 mask = (static_cast<uint64>(1) << (width - 1) * 4) | value;
static const char hexdigits[] = "0123456789abcdef";
do {
*--writer = hexdigits[value & 0xF];