| 194 | explicit ImportEventOp(OpKernelConstruction* ctx) : OpKernel(ctx) {} |
| 195 | |
| 196 | void Compute(OpKernelContext* ctx) override { |
| 197 | core::RefCountPtr<SummaryWriterInterface> s; |
| 198 | OP_REQUIRES_OK(ctx, LookupResource(ctx, HandleFromInput(ctx, 0), &s)); |
| 199 | const Tensor* t; |
| 200 | OP_REQUIRES_OK(ctx, ctx->input("event", &t)); |
| 201 | std::unique_ptr<Event> event{new Event}; |
| 202 | if (!ParseProtoUnlimited(event.get(), t->scalar<tstring>()())) { |
| 203 | ctx->CtxFailureWithWarning( |
| 204 | errors::DataLoss("Bad tf.Event binary proto tensor string")); |
| 205 | return; |
| 206 | } |
| 207 | OP_REQUIRES_OK(ctx, s->WriteEvent(std::move(event))); |
| 208 | } |
| 209 | }; |
| 210 | REGISTER_KERNEL_BUILDER(Name("ImportEvent").Device(DEVICE_CPU), ImportEventOp); |
| 211 |
nothing calls this directly
no test coverage detected