| 30 | class GetSparseFeature: public AsyncOpKernel { |
| 31 | public: |
| 32 | explicit GetSparseFeature(OpKernelConstruction* ctx): AsyncOpKernel(ctx) { |
| 33 | OP_REQUIRES_OK(ctx, ctx->GetAttr("feature_names", &feature_names_)); |
| 34 | OP_REQUIRES_OK(ctx, ctx->GetAttr("default_values", &default_values_)); |
| 35 | OP_REQUIRES_OK(ctx, ctx->GetAttr("N", &N_)); |
| 36 | OP_REQUIRES(ctx, default_values_.size() == feature_names_.size(), |
| 37 | errors::InvalidArgument( |
| 38 | "Require default_values.size() == feature_names_.size()")); |
| 39 | OP_REQUIRES(ctx, static_cast<size_t>(N_) == feature_names_.size(), |
| 40 | errors::InvalidArgument("Require N == feature_names.size")); |
| 41 | } |
| 42 | |
| 43 | void ComputeAsync(OpKernelContext* ctx, DoneCallback done) override; |
| 44 | |