Skip to content

Commit 4411926

Browse files
gharibiansaberkun
authored andcommitted
Migrate from std::string to tensorflow::tstring. (#7830)
Note that during the transition period tstring is typedef'ed to std::string. See: tensorflow/community#91
1 parent caab9e3 commit 4411926

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

embedding/word2vec_kernels.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ class SkipgramWord2vecOp : public OpKernel {
209209
vocab_size_ = static_cast<int32>(1 + ordered.size());
210210
Tensor word(DT_STRING, TensorShape({vocab_size_}));
211211
Tensor freq(DT_INT32, TensorShape({vocab_size_}));
212-
word.flat<string>()(0) = "UNK";
212+
word.flat<tstring>()(0) = "UNK";
213213
static const int32 kUnkId = 0;
214214
std::unordered_map<string, int32> word_id;
215215
int64 total_counted = 0;
216216
for (std::size_t i = 0; i < ordered.size(); ++i) {
217217
const auto& w = ordered[i].first;
218218
auto id = i + 1;
219-
word.flat<string>()(id) = w;
219+
word.flat<tstring>()(id) = w;
220220
auto word_count = ordered[i].second;
221221
freq.flat<int32>()(id) = word_count;
222222
total_counted += word_count;

0 commit comments

Comments
 (0)