| 72 | using OpKernel::OpKernel; |
| 73 | |
| 74 | void Compute(OpKernelContext* context) override { |
| 75 | const Tensor& tensor = context->input(0); |
| 76 | TensorProto proto; |
| 77 | if (tensor.dtype() == DT_STRING) { |
| 78 | tensor.AsProtoField(&proto); |
| 79 | } else { |
| 80 | tensor.AsProtoTensorContent(&proto); |
| 81 | } |
| 82 | Tensor* proto_string = nullptr; |
| 83 | OP_REQUIRES_OK(context, |
| 84 | context->allocate_output(0, TensorShape({}), &proto_string)); |
| 85 | CHECK(SerializeToTString(proto, &proto_string->scalar<tstring>()())); |
| 86 | } |
| 87 | }; |
| 88 | |
| 89 | #define REGISTER(T) \ |
nothing calls this directly
no test coverage detected