| 37 | class CopyOp : public OpKernel { |
| 38 | public: |
| 39 | explicit CopyOp(OpKernelConstruction* context) : OpKernel(context) { |
| 40 | OP_REQUIRES_OK(context, context->GetAttr("tensor_name", &tensor_name_)); |
| 41 | |
| 42 | std::vector<string> debug_ops_spec; |
| 43 | OP_REQUIRES_OK(context, |
| 44 | context->GetAttr("debug_ops_spec", &debug_ops_spec)); |
| 45 | for (const string& debug_op_spec : debug_ops_spec) { |
| 46 | // Assume debug_op_spec has the format |
| 47 | // <debug_op>;<debug_url>;<gated_grpc>, e.g., |
| 48 | // DebugIdentity;grpc://localhost:3333;1 |
| 49 | const std::vector<string> items = str_util::Split(debug_op_spec, ";"); |
| 50 | OP_REQUIRES( |
| 51 | context, items.size() == 3, |
| 52 | errors::Internal( |
| 53 | "Unexpected number of semicolons in debug_ops_spec element: ", |
| 54 | debug_op_spec)); |
| 55 | debug_op_and_url_specs_.push_back( |
| 56 | DebugWatchAndURLSpec(strings::StrCat(tensor_name_, ":", items[0]), |
| 57 | items[1], items[2] == "1")); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | void Compute(OpKernelContext* context) override { |
| 62 | const Tensor& src_tensor = context->input(0); |