Skip to content

Commit d323fa6

Browse files
jblespiaucopybara-github
authored andcommitted
Replace tensorflow::Status::OK() with tensorflow::OkStatus().
PiperOrigin-RevId: 473341684 Change-Id: I222376ff6f278af8a73a0698ac96137cecde5584
1 parent 50ad094 commit d323fa6

12 files changed

+45
-43
lines changed

tensorflow_compression/cc/kernels/range_coder_kernels.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Status CheckInRange(absl::string_view name, int64_t value, int64_t min,
5454
return errors::InvalidArgument(
5555
absl::Substitute("$0=$1 not in range [$2, $3)", name, value, min, max));
5656
}
57-
return Status::OK();
57+
return tensorflow::OkStatus();
5858
}
5959

6060
Status ScanCDF(const int32_t* const end, const int32_t** current,
@@ -83,7 +83,7 @@ Status ScanCDF(const int32_t* const end, const int32_t** current,
8383
++p;
8484
}
8585
*current = p;
86-
return Status::OK();
86+
return tensorflow::OkStatus();
8787
}
8888

8989
Status IndexCDFVector(const TTypes<int32_t>::ConstFlat& table,
@@ -94,7 +94,7 @@ Status IndexCDFVector(const TTypes<int32_t>::ConstFlat& table,
9494
for (const int32_t* current = start; current != end;) {
9595
TF_RETURN_IF_ERROR(ScanCDF(end, &current, lookup));
9696
}
97-
return Status::OK();
97+
return tensorflow::OkStatus();
9898
}
9999

100100
Status IndexCDFMatrix(const TTypes<int32_t>::ConstMatrix& table,
@@ -110,7 +110,7 @@ Status IndexCDFMatrix(const TTypes<int32_t>::ConstMatrix& table,
110110
return errors::InvalidArgument("CDF must end with 1 << precision.");
111111
}
112112
}
113-
return Status::OK();
113+
return tensorflow::OkStatus();
114114
}
115115

116116
class RangeEncoderInterface final : public EntropyEncoderInterface {
@@ -129,13 +129,13 @@ class RangeEncoderInterface final : public EntropyEncoderInterface {
129129
} else {
130130
OverflowEncode(row, value);
131131
}
132-
return Status::OK();
132+
return tensorflow::OkStatus();
133133
}
134134

135135
Status Finalize(std::string* sink) override {
136136
encoder_.Finalize(&encoded_);
137137
*sink = std::move(encoded_);
138-
return Status::OK();
138+
return tensorflow::OkStatus();
139139
}
140140

141141
private:
@@ -193,14 +193,14 @@ class RangeDecoderInterface final : public EntropyDecoderInterface {
193193
} else {
194194
*output = OverflowDecode(row);
195195
}
196-
return Status::OK();
196+
return tensorflow::OkStatus();
197197
}
198198

199199
Status Finalize() override {
200200
if (!decoder_.Finalize()) {
201201
return errors::DataLoss("RangeDecoder returned an error status");
202202
}
203-
return Status::OK();
203+
return tensorflow::OkStatus();
204204
}
205205

206206
private:
@@ -318,7 +318,7 @@ class EntropyEncodeChannelOp : public tensorflow::OpKernel {
318318
"'value' shape should start with 'handle' shape: value.shape=",
319319
value_shape, " does not start with handle.shape=", handle_shape);
320320
}
321-
return tensorflow::Status::OK();
321+
return tensorflow::OkStatus();
322322
}
323323

324324
void Compute(tensorflow::OpKernelContext* context) override {
@@ -419,7 +419,7 @@ class EntropyEncodeIndexOp : public tensorflow::OpKernel {
419419
index_shape, " does not start with handle.shape=", handle_shape);
420420
}
421421

422-
return tensorflow::Status::OK();
422+
return tensorflow::OkStatus();
423423
}
424424

425425
void Compute(tensorflow::OpKernelContext* context) override {
@@ -576,7 +576,7 @@ class EntropyDecodeChannelOp : public tensorflow::OpKernel {
576576
tensorflow::tensor::MakeShape(context->input(1), &suffix_shape));
577577
*output_shape = context->input(0).shape();
578578
output_shape->AppendShape(suffix_shape);
579-
return tensorflow::Status::OK();
579+
return tensorflow::OkStatus();
580580
}
581581

582582
void Compute(tensorflow::OpKernelContext* context) override {
@@ -678,7 +678,7 @@ class EntropyDecodeIndexOp : public tensorflow::OpKernel {
678678
", shape=", suffix_shape);
679679
}
680680

681-
return tensorflow::Status::OK();
681+
return tensorflow::OkStatus();
682682
}
683683

684684
void Compute(tensorflow::OpKernelContext* context) override {

tensorflow_compression/cc/kernels/range_coding_kernels.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ Status CheckCdfShape(const TensorShape& data_shape,
144144
"The last dimension of `cdf` should be > 1: ", cdf_shape.DebugString());
145145
}
146146

147-
return Status::OK();
147+
return tensorflow::OkStatus();
148148
}
149149

150150
tensorflow::Status CheckCdfValues(int precision,
@@ -169,7 +169,7 @@ tensorflow::Status CheckCdfValues(int precision,
169169
}
170170
}
171171
}
172-
return tensorflow::Status::OK();
172+
return tensorflow::OkStatus();
173173
}
174174

175175
class RangeEncodeOp : public OpKernel {
@@ -265,7 +265,7 @@ class RangeEncodeOp : public OpKernel {
265265
}
266266

267267
encoder.Finalize(output);
268-
return tensorflow::Status::OK();
268+
return tensorflow::OkStatus();
269269
}
270270

271271
int precision_;
@@ -369,7 +369,7 @@ class RangeDecodeOp : public OpKernel {
369369

370370
*data = decoder.Decode({cdf_slice, chip_size}, precision_);
371371
}
372-
return tensorflow::Status::OK();
372+
return tensorflow::OkStatus();
373373
}
374374

375375
int precision_;

tensorflow_compression/cc/kernels/range_coding_kernels_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class RangeCoderOpsTest : public OpsTestBase {
130130
*output = *GetOutput(0);
131131
inputs_.clear();
132132

133-
return Status::OK();
133+
return tensorflow::OkStatus();
134134
}
135135

136136
Status RunDecodeOp(int precision, absl::Span<const Tensor> input,
@@ -166,7 +166,7 @@ class RangeCoderOpsTest : public OpsTestBase {
166166
*output = *GetOutput(0);
167167
inputs_.clear();
168168

169-
return Status::OK();
169+
return tensorflow::OkStatus();
170170
}
171171

172172
void TestEncodeAndDecode(int precision, const Tensor& data,

tensorflow_compression/cc/kernels/range_coding_kernels_util.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ Status MergeAxes(const TensorShape& broadcast_shape,
8787
}
8888
merged_storage_shape.push_back(storage_stride);
8989

90-
return Status::OK();
90+
return tensorflow::OkStatus();
9191
}
9292

9393
} // namespace tensorflow_compression

tensorflow_compression/cc/kernels/run_length_gamma_kernels_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class BitCodingOpsTest : public OpsTestBase {
7373
TF_RETURN_IF_ERROR(RunOpKernel());
7474
*output = *GetOutput(0);
7575
inputs_.clear();
76-
return Status::OK();
76+
return tensorflow::OkStatus();
7777
}
7878

7979
Status RunDecodeOp(absl::Span<const Tensor> inputs, Tensor* output) {
@@ -91,7 +91,7 @@ class BitCodingOpsTest : public OpsTestBase {
9191
TF_RETURN_IF_ERROR(RunOpKernel());
9292
*output = *GetOutput(0);
9393
inputs_.clear();
94-
return Status::OK();
94+
return tensorflow::OkStatus();
9595
}
9696

9797
void TestEncodeAndDecode(const Tensor& data_tensor) {

tensorflow_compression/cc/kernels/unbounded_index_range_coding_kernels.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ tensorflow::Status CheckIndex(int64_t upper_bound, const Tensor& index) {
5959
upper_bound, "): value=", flat(i));
6060
}
6161
}
62-
return tensorflow::Status::OK();
62+
return tensorflow::OkStatus();
6363
}
6464

6565
tensorflow::Status CheckCdfSize(int64_t upper_bound, const Tensor& cdf_size) {
@@ -70,7 +70,7 @@ tensorflow::Status CheckCdfSize(int64_t upper_bound, const Tensor& cdf_size) {
7070
upper_bound, "]: value=", flat(i));
7171
}
7272
}
73-
return tensorflow::Status::OK();
73+
return tensorflow::OkStatus();
7474
}
7575

7676
tensorflow::Status CheckCdf(int precision, const Tensor& cdf,
@@ -96,7 +96,7 @@ tensorflow::Status CheckCdf(int precision, const Tensor& cdf,
9696
}
9797
}
9898
}
99-
return tensorflow::Status::OK();
99+
return tensorflow::OkStatus();
100100
}
101101

102102
// Assumes that CheckArgumentShapes().ok().
@@ -107,7 +107,7 @@ tensorflow::Status CheckArgumentValues(int precision, const Tensor& index,
107107
TF_RETURN_IF_ERROR(CheckIndex(cdf.dim_size(0), index));
108108
TF_RETURN_IF_ERROR(CheckCdfSize(cdf.dim_size(1), cdf_size));
109109
TF_RETURN_IF_ERROR(CheckCdf(precision, cdf, cdf_size));
110-
return tensorflow::Status::OK();
110+
return tensorflow::OkStatus();
111111
}
112112

113113
tensorflow::Status CheckArgumentShapes(const Tensor& index, const Tensor& cdf,
@@ -131,7 +131,7 @@ tensorflow::Status CheckArgumentShapes(const Tensor& index, const Tensor& cdf,
131131
"should match the number of rows in 'cdf': offset.shape=",
132132
offset.shape(), ", cdf.shape=", cdf.shape());
133133
}
134-
return tensorflow::Status::OK();
134+
return tensorflow::OkStatus();
135135
}
136136

137137
class UnboundedIndexRangeEncodeOp : public OpKernel {
@@ -365,7 +365,7 @@ class UnboundedIndexRangeDecodeOp : public OpKernel {
365365
output(i) = value;
366366
}
367367

368-
return tensorflow::Status::OK();
368+
return tensorflow::OkStatus();
369369
}
370370

371371
int precision_;

tensorflow_compression/cc/kernels/unbounded_index_range_coding_kernels_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class UnboundedIndexRangeCoderOpsTest : public OpsTestBase {
167167
*output = *GetOutput(0);
168168
inputs_.clear();
169169

170-
return Status::OK();
170+
return tensorflow::OkStatus();
171171
}
172172

173173
Status RunDecodeOpDebug(int precision, int overflow_width,
@@ -205,7 +205,7 @@ class UnboundedIndexRangeCoderOpsTest : public OpsTestBase {
205205
*output = *GetOutput(0);
206206
inputs_.clear();
207207

208-
return Status::OK();
208+
return tensorflow::OkStatus();
209209
}
210210

211211
void TestEncodeAndDecode(int precision, int overflow_width,

tensorflow_compression/cc/kernels/y4m_dataset_kernels.cc

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ class Y4MDatasetOp : public DatasetOpKernel {
9393
string DebugString() const override { return "Y4MDatasetOp::Dataset"; }
9494

9595
Status InputDatasets(vector<const DatasetBase*>* inputs) const override {
96-
return Status::OK();
96+
return tensorflow::OkStatus();
9797
}
9898

99-
Status CheckExternalState() const override { return Status::OK(); }
99+
Status CheckExternalState() const override {
100+
return tensorflow::OkStatus();
101+
}
100102

101103
protected:
102104
Status AsGraphDefInternal(SerializationContext* ctx,
@@ -105,7 +107,7 @@ class Y4MDatasetOp : public DatasetOpKernel {
105107
Node* filenames = nullptr;
106108
TF_RETURN_IF_ERROR(b->AddVector(filenames_, &filenames));
107109
TF_RETURN_IF_ERROR(b->AddDataset(this, {filenames}, output));
108-
return Status::OK();
110+
return tensorflow::OkStatus();
109111
}
110112

111113
private:
@@ -197,7 +199,7 @@ class Y4MDatasetOp : public DatasetOpKernel {
197199
// Exit if there are no more files to process.
198200
if (file_index_ >= dataset()->filenames_.size()) {
199201
*end_of_sequence = true;
200-
return Status::OK();
202+
return tensorflow::OkStatus();
201203
}
202204

203205
// Open next file.
@@ -225,7 +227,7 @@ class Y4MDatasetOp : public DatasetOpKernel {
225227
TF_RETURN_IF_ERROR(
226228
writer->WriteScalar(full_name("file_pos"), file_pos));
227229

228-
return Status::OK();
230+
return tensorflow::OkStatus();
229231
}
230232

231233
Status RestoreInternal(
@@ -250,7 +252,7 @@ class Y4MDatasetOp : public DatasetOpKernel {
250252
chroma_format_));
251253
file_pos_ = file_pos;
252254
}
253-
return Status::OK();
255+
return tensorflow::OkStatus();
254256
}
255257

256258
private:
@@ -278,7 +280,7 @@ class Y4MDatasetOp : public DatasetOpKernel {
278280
std::memcpy(&header[offset], chunk.data(), pos + 1);
279281
}
280282
header.resize(offset + pos + 1);
281-
return Status::OK();
283+
return tensorflow::OkStatus();
282284
}
283285
// We reached the end of the file, and the header is not complete.
284286
if (!status.ok()) {
@@ -390,7 +392,7 @@ class Y4MDatasetOp : public DatasetOpKernel {
390392
"Input file '", dataset()->filenames_[file_index],
391393
"' has 4:2:0 chroma format, but odd width or height.");
392394
}
393-
return Status::OK();
395+
return tensorflow::OkStatus();
394396
}
395397

396398
mutex mu_;

tensorflow_compression/cc/ops/pmf_to_cdf_ops.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ REGISTER_OP("PmfToQuantizedCdf")
3737
ShapeHandle out;
3838
TF_RETURN_IF_ERROR(c->ReplaceDim(in, -1, last, &out));
3939
c->set_output(0, out);
40-
return Status::OK();
40+
return tensorflow::OkStatus();
4141
})
4242
.Doc(R"doc(
4343
Converts a PMF into a quantized CDF for range coding.

tensorflow_compression/cc/ops/range_coder_ops.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ REGISTER_OP("EntropyDecodeChannel")
166166
TF_RETURN_IF_ERROR(c->MakeShapeFromShapeTensor(1, &suffix_shape));
167167
TF_RETURN_IF_ERROR(c->Concatenate(shape, suffix_shape, &shape));
168168
c->set_output(1, shape);
169-
return Status::OK();
169+
return tensorflow::OkStatus();
170170
})
171171
.Doc(R"doc(
172172
Decodes the encoded stream inside `handle`.
@@ -208,7 +208,7 @@ REGISTER_OP("EntropyDecodeIndex")
208208
TF_RETURN_IF_ERROR(c->MakeShapeFromShapeTensor(2, &suffix_shape));
209209
TF_RETURN_IF_ERROR(c->Concatenate(shape, suffix_shape, &shape));
210210
c->set_output(1, shape);
211-
return Status::OK();
211+
return tensorflow::OkStatus();
212212
})
213213
.Doc(R"doc(
214214
Decodes the encoded stream inside `handle`.

0 commit comments

Comments
 (0)