Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 2594069

Browse files
gharibiancopybara-github
authored andcommitted
Migrate from std::string to tensorflow::tstring.
Note that during the transition period tstring is typedef'ed to std::string. See: tensorflow/community#91 PiperOrigin-RevId: 282043204
1 parent d979d9f commit 2594069

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tensor2tensor/data_generators/ops/subword_text_encoder_ops.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ using ::tensorflow::OpKernelContext;
1414
using ::tensorflow::Status;
1515
using ::tensorflow::Tensor;
1616
using ::tensorflow::TensorShape;
17+
using ::tensorflow::tstring;
1718
using ::tensorflow::shape_inference::InferenceContext;
1819

1920
REGISTER_OP("SubwordTextEncoderEncode")
@@ -36,7 +37,7 @@ class SubwordTextEncoderEncodeOp : public OpKernel {
3637

3738
void Compute(OpKernelContext* ctx) override {
3839
// Get input string and deserialize into ArticleExample proto.
39-
const string& s = ctx->input(0).scalar<string>()();
40+
absl::string_view s = ctx->input(0).scalar<tstring>()();
4041

4142
// Construct encoded output tensors.
4243
std::vector<int> encoded_ids;

0 commit comments

Comments
 (0)