MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / Decode

Method Decode

tensorflow/core/kernels/unicode_ops.cc:372–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

370 }
371
372 void Decode(OpKernelContext* ctx, std::vector<UChar32>* char_values,
373 std::vector<SPLITS_TYPE>* offset_values, int* current_offset,
374 SPLITS_TYPE* next_row_split, UChar32 char_value, int char_length,
375 bool found_any_format_error) {
376 if (error_options_.error_on_malformatting && found_any_format_error) {
377 ctx->CtxFailure(
378 errors::InvalidArgument("Invalid formatting on input string"));
379 }
380 UChar32 decoded_value = char_value;
381 if (ShouldHandleFormatError(error_options_, char_value,
382 found_any_format_error)) {
383 if (error_options_.elide_replacement && (offset_values != nullptr)) {
384 *current_offset += char_length;
385 return;
386 } else {
387 decoded_value = error_options_.subst;
388 }
389 }
390
391 // Emit the char value.
392 char_values->push_back(decoded_value);
393
394 // Emit the byte offset
395 if (offset_values != nullptr) {
396 offset_values->push_back(*current_offset);
397 *current_offset += char_length;
398 }
399 *next_row_split += 1;
400 }
401
402 void Compute(OpKernelContext* ctx) override {
403 const Tensor* input_tensor;

Callers

nothing calls this directly

Calls 4

InvalidArgumentFunction · 0.85
ShouldHandleFormatErrorFunction · 0.85
CtxFailureMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected