| 119 | class BaseDebugOp : public OpKernel { |
| 120 | public: |
| 121 | explicit BaseDebugOp(const string& debug_op_name, |
| 122 | OpKernelConstruction* context) |
| 123 | : OpKernel(context), debug_op_name_(debug_op_name) { |
| 124 | OP_REQUIRES_OK(context, context->GetAttr("debug_urls", &debug_urls_)); |
| 125 | OP_REQUIRES_OK(context, context->GetAttr("gated_grpc", &gated_grpc_)); |
| 126 | |
| 127 | string device_name; |
| 128 | string tensor_name; |
| 129 | OP_REQUIRES_OK(context, context->GetAttr("device_name", &device_name)); |
| 130 | OP_REQUIRES_OK(context, context->GetAttr("tensor_name", &tensor_name)); |
| 131 | |
| 132 | std::vector<string> name_items = str_util::Split(tensor_name, ':'); |
| 133 | string node_name; |
| 134 | int32 output_slot = 0; |
| 135 | OP_REQUIRES(context, name_items.size() == 1 || name_items.size() == 2, |
| 136 | errors::InvalidArgument("Failed to parse tensor name: \"", |
| 137 | tensor_name, "\"")); |
| 138 | if (name_items.size() == 2) { |
| 139 | node_name = name_items[0]; |
| 140 | OP_REQUIRES( |
| 141 | context, strings::safe_strto32(name_items[1], &output_slot), |
| 142 | errors::InvalidArgument("Invalid string value for output_slot: \"", |
| 143 | name_items[1], "\"")); |
| 144 | } else if (name_items.size() == 1) { |
| 145 | node_name = name_items[0]; |
| 146 | } |
| 147 | |
| 148 | debug_watch_key_.reset( |
| 149 | new DebugNodeKey(device_name, node_name, output_slot, debug_op_name_)); |
| 150 | } |
| 151 | |
| 152 | bool IsExpensive() override { return false; } |
| 153 |
nothing calls this directly
no test coverage detected