| 327 | explicit WriteGraphSummaryOp(OpKernelConstruction* ctx) : OpKernel(ctx) {} |
| 328 | |
| 329 | void Compute(OpKernelContext* ctx) override { |
| 330 | core::RefCountPtr<SummaryWriterInterface> s; |
| 331 | OP_REQUIRES_OK(ctx, LookupResource(ctx, HandleFromInput(ctx, 0), &s)); |
| 332 | const Tensor* t; |
| 333 | OP_REQUIRES_OK(ctx, ctx->input("step", &t)); |
| 334 | const int64 step = t->scalar<int64>()(); |
| 335 | OP_REQUIRES_OK(ctx, ctx->input("tensor", &t)); |
| 336 | std::unique_ptr<GraphDef> graph{new GraphDef}; |
| 337 | if (!ParseProtoUnlimited(graph.get(), t->scalar<tstring>()())) { |
| 338 | ctx->CtxFailureWithWarning( |
| 339 | errors::DataLoss("Bad tf.GraphDef binary proto tensor string")); |
| 340 | return; |
| 341 | } |
| 342 | OP_REQUIRES_OK(ctx, s->WriteGraph(step, std::move(graph))); |
| 343 | } |
| 344 | }; |
| 345 | REGISTER_KERNEL_BUILDER(Name("WriteGraphSummary").Device(DEVICE_CPU), |
| 346 | WriteGraphSummaryOp); |
nothing calls this directly
no test coverage detected