| 891 | explicit LookupTableSizeOp(OpKernelConstruction* ctx) : OpKernel(ctx) {} |
| 892 | |
| 893 | void Compute(OpKernelContext* ctx) override { |
| 894 | lookup::LookupInterface* table; |
| 895 | OP_REQUIRES_OK(ctx, GetLookupTable("table_handle", ctx, &table)); |
| 896 | core::ScopedUnref unref_me(table); |
| 897 | |
| 898 | Tensor* out; |
| 899 | OP_REQUIRES_OK(ctx, ctx->allocate_output("size", TensorShape({}), &out)); |
| 900 | out->flat<int64>().setConstant(table->size()); |
| 901 | } |
| 902 | }; |
| 903 | |
| 904 | REGISTER_KERNEL_BUILDER(Name("LookupTableSize").Device(DEVICE_CPU), |
nothing calls this directly
no test coverage detected