diff options
author | Suharsh Sivakumar <suharshs@google.com> | 2017-04-19 13:52:40 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-04-19 15:03:58 -0700 |
commit | c6ab1fb225d3d44a9d39666991db0f7eb654c018 (patch) | |
tree | 50319e7d4ad883e00085295febe354843792ebf1 /tensorflow/cc/framework | |
parent | 1fc916d0c16eab89523b1e031854313ab1ba18e2 (diff) |
Remove all 64/32 bit warnings in tensorflow/cc
Change: 153637886
Diffstat (limited to 'tensorflow/cc/framework')
-rw-r--r-- | tensorflow/cc/framework/cc_op_gen.cc | 4 | ||||
-rw-r--r-- | tensorflow/cc/framework/gradient_checker.cc | 12 | ||||
-rw-r--r-- | tensorflow/cc/framework/gradients.cc | 6 | ||||
-rw-r--r-- | tensorflow/cc/framework/ops.cc | 6 | ||||
-rw-r--r-- | tensorflow/cc/framework/ops.h | 32 |
5 files changed, 30 insertions, 30 deletions
diff --git a/tensorflow/cc/framework/cc_op_gen.cc b/tensorflow/cc/framework/cc_op_gen.cc index 26f15975c1..b7e9948e9d 100644 --- a/tensorflow/cc/framework/cc_op_gen.cc +++ b/tensorflow/cc/framework/cc_op_gen.cc @@ -730,7 +730,7 @@ void OpInfo::GetOutput(string* out) const { // One output, no need for NameRangeMap if (is_list_output[0]) { strings::StrAppend(out, - " for (int64 i = 0; i < ret->num_outputs(); ++i)\n"); + " for (int32 i = 0; i < ret->num_outputs(); ++i)\n"); strings::StrAppend(out, " this->", output_names[0], ".push_back(Output(ret, i));\n"); } else { @@ -753,7 +753,7 @@ void OpInfo::GetOutput(string* out) const { const string arg_range = strings::StrCat( "_outputs_range[\"", graph_op_def.output_arg(i).name(), "\"]"); if (is_list_output[i]) { - strings::StrAppend(out, " for (int64 i = ", arg_range, ".first; i < ", + strings::StrAppend(out, " for (int32 i = ", arg_range, ".first; i < ", arg_range, ".second; ++i)\n"); strings::StrAppend(out, " this->", output_names[i], ".push_back(Output(ret, i));\n"); diff --git a/tensorflow/cc/framework/gradient_checker.cc b/tensorflow/cc/framework/gradient_checker.cc index 849a8eed6f..8f20ff1457 100644 --- a/tensorflow/cc/framework/gradient_checker.cc +++ b/tensorflow/cc/framework/gradient_checker.cc @@ -40,8 +40,8 @@ Status ComputeTheoreticalJacobianTranspose( const std::vector<Tensor>& x_datas, const OutputList& ys, const std::vector<TensorShape>& y_shapes, std::vector<Tensor>& jacobian_ts) { - int y_num = y_shapes.size(); - int x_num = x_shapes.size(); + size_t y_num = y_shapes.size(); + size_t x_num = x_shapes.size(); // Call AddSymbolicGradients to get 'dxs' (we will feed 'dys'). OutputList dys; for (const auto& y_shape : y_shapes) { @@ -130,8 +130,8 @@ Status ComputeNumericJacobianTranspose(const Scope& scope, const OutputList& xs, const T delta, std::vector<Tensor>& x_datas, std::vector<Tensor>& jacobian_ts) { - int y_num = y_shapes.size(); - int x_num = x_shapes.size(); + size_t y_num = y_shapes.size(); + size_t x_num = x_shapes.size(); ClientSession session(scope); for (int x_idx = 0; x_idx < x_num; x_idx++) { @@ -176,8 +176,8 @@ void InitJacobians(const OutputList& xs, const std::vector<TensorShape>& x_shapes, const std::vector<TensorShape>& y_shapes, std::vector<Tensor>& jacobians) { - int y_num = y_shapes.size(); - int x_num = x_shapes.size(); + size_t y_num = y_shapes.size(); + size_t x_num = x_shapes.size(); jacobians.resize(y_num * x_num); for (int x_idx = 0; x_idx < x_num; x_idx++) { diff --git a/tensorflow/cc/framework/gradients.cc b/tensorflow/cc/framework/gradients.cc index 4ada9351ca..8c00a6f704 100644 --- a/tensorflow/cc/framework/gradients.cc +++ b/tensorflow/cc/framework/gradients.cc @@ -210,8 +210,8 @@ Status SymbolicGradientBuilder::Initialize() { { // Initialize backprop with `grad_inputs_`. - const int num_dy = grad_inputs_.size(); - for (int i = 0; i < num_dy; ++i) { + const size_t num_dy = grad_inputs_.size(); + for (size_t i = 0; i < num_dy; ++i) { TF_RETURN_IF_ERROR(BackpropAlongEdge(grad_inputs_[i], outputs_[i])); } } @@ -308,7 +308,7 @@ Status SymbolicGradientBuilder::AddGradients() { continue; } - const int num_no_grad = no_grad_dy_indices.size(); + const size_t num_no_grad = no_grad_dy_indices.size(); if (IsPrimitiveOpWithNoGrad(n->type_string()) || num_no_grad == num_y) { // No grad defined for this op, or all outputs returned 'NoGradient': // Backprop 'NoGradient' along the in edges. diff --git a/tensorflow/cc/framework/ops.cc b/tensorflow/cc/framework/ops.cc index 50df891a4c..920a8e7955 100644 --- a/tensorflow/cc/framework/ops.cc +++ b/tensorflow/cc/framework/ops.cc @@ -20,7 +20,7 @@ namespace tensorflow { Operation::Operation(Node* n) : inputs_(GetInputs(n)), node_(n) {} -Output Operation::input(int i) const { +Output Operation::input(int32 i) const { CHECK_NOTNULL(node_); CHECK_GE(i, 0); CHECK_LT(i, node_->num_inputs()); @@ -37,14 +37,14 @@ Output Operation::input(int i) const { return Output(inputs_[i].first, inputs_[i].second); } -Output Operation::output(int i) const { +Output Operation::output(int32 i) const { CHECK_NOTNULL(node_); CHECK_GE(i, 0); CHECK_LT(i, node_->num_outputs()); return Output(node_, i); } -uint64 Operation::hash(int64 index) const { +uint64 Operation::hash(int32 index) const { return ::tensorflow::Hash64(reinterpret_cast<const char*>(&node_), sizeof(Node*), index); } diff --git a/tensorflow/cc/framework/ops.h b/tensorflow/cc/framework/ops.h index 889d5db31d..8d4154220c 100644 --- a/tensorflow/cc/framework/ops.h +++ b/tensorflow/cc/framework/ops.h @@ -39,22 +39,22 @@ class Operation { Operation() : node_(nullptr) {} explicit Operation(Node* n); - int num_inputs() const { return node_->num_inputs(); } - DataType input_type(int o) const { return node_->input_type(o); } - Output input(int i) const; + int32 num_inputs() const { return node_->num_inputs(); } + DataType input_type(int32 o) const { return node_->input_type(o); } + Output input(int32 i) const; - int num_outputs() const { return node_->num_outputs(); } - DataType output_type(int o) const { return node_->output_type(o); } - Output output(int i) const; + int32 num_outputs() const { return node_->num_outputs(); } + DataType output_type(int32 o) const { return node_->output_type(o); } + Output output(int32 i) const; Node* node() const { return node_; } - uint64 hash(int64 index) const; + uint64 hash(int32 index) const; bool operator==(const Operation& other) const { return node_ == other.node_; } private: - typedef std::vector<std::pair<Node*, int64>> Inputs; + typedef std::vector<std::pair<Node*, int32>> Inputs; static Inputs GetInputs(Node* node); Inputs inputs_; @@ -66,12 +66,12 @@ class Output { public: Output() = default; explicit Output(Node* n) : op_(n) {} - Output(Node* n, int64 index) : op_(n), index_(index) {} - Output(const Operation& op, int64 index) : op_(op), index_(index) {} + Output(Node* n, int32 index) : op_(n), index_(index) {} + Output(const Operation& op, int32 index) : op_(op), index_(index) {} Operation op() const { return op_; } Node* node() const { return op().node(); } - int64 index() const { return index_; } + int32 index() const { return index_; } DataType type() const { return op_.output_type(index_); } string name() const { return strings::StrCat(node()->name(), ":", index()); } bool operator==(const Output& other) const { @@ -82,14 +82,14 @@ class Output { private: Operation op_ = Operation(nullptr); - int64 index_ = 0; + int32 index_ = 0; }; /// Hash class that can be used for e.g. storing Outputs in an unordered_map struct OutputHash { std::size_t operator()(const Output& output) const { return Hash64Combine(std::hash<Node*>()(output.node()), - std::hash<int64>()(output.index())); + std::hash<int32>()(output.index())); } }; @@ -230,12 +230,12 @@ class Input { /// Constructor specifying a node name, index and datatype. This should only /// be used for specifying a backward edge, needed by control flow. - Input(const string& name, int i, DataType dt) + Input(const string& name, int32 i, DataType dt) : node_name_(name), index_(i), data_type_(dt) {} Node* node() const { return output_.node(); } string node_name() const { return node_name_; } - int index() const { return node_name_.empty() ? output_.index() : index_; } + int32 index() const { return node_name_.empty() ? output_.index() : index_; } DataType data_type() const { return data_type_; } Status status() const { return status_; } const Tensor& tensor() const { return tensor_; } @@ -245,7 +245,7 @@ class Input { Output output_ = Output(Operation(nullptr), 0); Tensor tensor_; const string node_name_ = ""; - int index_ = 0; + int32 index_ = 0; DataType data_type_ = DT_INVALID; }; |