Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions tensorflow_text/core/kernels/constrained_sequence_kernel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ absl::Status ValidateConstraintTensor(const Tensor &tensor,
const bool use_start_end_states,
const string &name) {
if (tensor.shape().dims() != 2) {
return InvalidArgument(
tensorflow::strings::StrCat(name, " must be of rank 2"));
return InvalidArgument(absl::StrCat(name, " must be of rank 2"));
}
int expected_size = use_start_end_states ? num_states + 1 : num_states;
if (tensor.shape().dim_size(0) != expected_size) {
Expand Down Expand Up @@ -110,7 +109,7 @@ class ConstrainedSequence : public OpKernel {
const int num_scores = scores.num_scores();

OP_REQUIRES(context, lengths_tensor.NumElements() == batch_size,
InvalidArgument(tensorflow::strings::StrCat(
InvalidArgument(absl::StrCat(
"There should be exactly one length for every batch "
"element. Found ",
lengths_tensor.NumElements(),
Expand Down
18 changes: 9 additions & 9 deletions tensorflow_text/core/kernels/sentencepiece_kernels.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ struct SentencepieceResource : public ResourceBase {
(reverse == this->reverse);
}

Status AsGraphDef(GraphDefBuilder* builder, Node** out) const override {
sentencepiece::util::Status AsGraphDef(GraphDefBuilder* builder, Node** out) const override {
absl::ReaderMutexLock l(&mu);
// We set use_node_name_sharing with a unique node name so that the resource
// can outlive the kernel. This means that the lifetime of the re-created
// resource will be tied to the lifetime of the resource manager it is
// created in.
static std::atomic<int64> counter(0);
std::string unique_node_name = strings::StrCat(
std::string unique_node_name = absl::StrCat(
"SentencepieceResourceFromGraphDef", "/", counter.fetch_add(1));
std::string model = processor.model_proto().SerializeAsString();
*out = ops::SourceOp(
Expand All @@ -94,10 +94,10 @@ struct SentencepieceResource : public ResourceBase {
// TODO(broken) Determine a medium cost of a call to the SentencePiece processor
constexpr int64 kCostPerUnit = 10000;

::tensorflow::Status ToTFStatus(const sentencepiece::util::Status& s) {
if (s.ok()) return ::tensorflow::Status();
return ::tensorflow::Status(static_cast<::absl::StatusCode>(s.code()),
::tensorflow::string(s.message()));
absl::Status ToTFStatus(const sentencepiece::util::Status& s) {
if (s.ok()) return sentencepiece::util::Status();
return sentencepiece::util::Status(static_cast<::absl::StatusCode>(s.code()),
::tensorflow::string(s.message()));
}

template <typename T>
Expand All @@ -115,8 +115,8 @@ int32 GetPieceOrId<int32>(
return sp.id();
}

tensorflow::Status HandleExtraOptions(OpKernelContext* ctx,
SentencepieceResource* sp) {
absl::Status HandleExtraOptions(OpKernelContext* ctx,
SentencepieceResource* sp) {
const Tensor* add_bos_tensor = nullptr;
TF_RETURN_IF_ERROR(ctx->input("add_bos", &add_bos_tensor));
const bool add_bos = add_bos_tensor->scalar<bool>()();
Expand Down Expand Up @@ -210,7 +210,7 @@ class SentencepieceOp : public OpKernel {
GetNodeAttr(this->def(), "model", &model_proto_attr));

if (TF_PREDICT_FALSE(model_proto_attr.empty())) {
return Status(tensorflow::errors::InvalidArgument(
return sentencepiece::util::Status(tensorflow::errors::InvalidArgument(
"Model argument must be specified."));
}
// Loads serialized sentencepiece model proto to enable embedding
Expand Down