Skip to content

Commit

Permalink
Update substring calculation function name
Browse files Browse the repository at this point in the history
  • Loading branch information
adityagoel4512 committed Jan 10, 2024
1 parent 7109712 commit b6b17a1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions onnxruntime/core/providers/cpu/nn/string_split.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ONNX_CPU_OPERATOR_KERNEL(StringSplit, 20,
/// Calculate substrings in ``str`` delimited by ``delimiter``. A maximum of ``max_splits`` splits are permitted.
/// Returns a vector of string slices into ``str`` representing the substrings as string views. The user must ensure
/// the returned views' lifetime does not exceed ``str``'s.
InlinedVector<std::string_view> FillSubstrings(std::string_view str, std::string_view delimiter, int64_t max_splits) {
InlinedVector<std::string_view> ComputeSubstrings(std::string_view str, std::string_view delimiter, int64_t max_splits) {
InlinedVector<std::string_view> output;
if (str.empty()) {
return output;
Expand Down Expand Up @@ -61,7 +61,7 @@ InlinedVector<std::string_view> FillSubstrings(std::string_view str, std::string

StringSplit::StringSplit(const OpKernelInfo& info) : OpKernel(info) {
info.GetAttrOrDefault("maxsplit", &maxsplit_, std::numeric_limits<int64_t>::max() - 1);
info.GetAttrOrDefault("delimiter", &delimiter_, std::string(""));
info.GetAttrOrDefault("delimiter", &delimiter_, std::string());
}

Status StringSplit::Compute(OpKernelContext* context) const {
Expand All @@ -78,9 +78,9 @@ Status StringSplit::Compute(OpKernelContext* context) const {

auto input_slice_iterator = input_slices.begin();
for (auto input_iter = input_data.begin(); input_iter != input_data.end(); input_iter++, input_slice_iterator++, num_tokens_iter++) {
auto substrs = FillSubstrings(*input_iter, delimiter_, maxsplit_);
auto substrs = ComputeSubstrings(*input_iter, delimiter_, maxsplit_);
auto substr_count = static_cast<int64_t>(substrs.size());
input_slices.push_back(substrs);
input_slices.push_back(std::move(substrs));
last_dim = std::max(last_dim, substr_count);
*num_tokens_iter = substr_count;
}
Expand Down

0 comments on commit b6b17a1

Please sign in to comment.