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

Method DecodeCSVOp

tensorflow/core/kernels/decode_csv_op.cc:31–56  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29class DecodeCSVOp : public OpKernel {
30 public:
31 explicit DecodeCSVOp(OpKernelConstruction* ctx) : OpKernel(ctx) {
32 string delim;
33
34 OP_REQUIRES_OK(ctx, ctx->GetAttr("OUT_TYPE", &out_type_));
35 OP_REQUIRES(ctx, out_type_.size() < std::numeric_limits<int>::max(),
36 errors::InvalidArgument("Out type too large"));
37 OP_REQUIRES_OK(ctx, ctx->GetAttr("field_delim", &delim));
38 OP_REQUIRES_OK(ctx, ctx->GetAttr("use_quote_delim", &use_quote_delim_));
39 OP_REQUIRES_OK(ctx, ctx->GetAttr("select_cols", &select_cols_));
40 OP_REQUIRES(
41 ctx, out_type_.size() == select_cols_.size() || select_cols_.empty(),
42 errors::InvalidArgument("select_cols should match output size"));
43 select_all_cols_ = select_cols_.empty();
44 for (int i = 1; i < select_cols_.size(); i++) {
45 OP_REQUIRES(ctx, select_cols_[i - 1] < select_cols_[i],
46 errors::InvalidArgument(
47 "select_cols should be strictly increasing indices"));
48 }
49 OP_REQUIRES(
50 ctx, select_cols_.empty() || select_cols_.front() >= 0,
51 errors::InvalidArgument("select_cols should be non-negative indices"));
52 OP_REQUIRES(ctx, delim.size() == 1,
53 errors::InvalidArgument("field_delim should be only 1 char"));
54 delim_ = delim[0];
55 OP_REQUIRES_OK(ctx, ctx->GetAttr("na_value", &na_value_));
56 }
57
58 void Compute(OpKernelContext* ctx) override {
59 const Tensor* records;

Callers

nothing calls this directly

Calls 6

InvalidArgumentFunction · 0.85
maxFunction · 0.50
GetAttrMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45
frontMethod · 0.45

Tested by

no test coverage detected