| 174 | } |
| 175 | |
| 176 | void TF_GetInput(TF_OpKernelContext* ctx, int i, TF_Tensor** tensor, |
| 177 | TF_Status* status) { |
| 178 | auto* cc_ctx = reinterpret_cast<::tensorflow::OpKernelContext*>(ctx); |
| 179 | if (i < 0 || i >= cc_ctx->num_inputs()) { |
| 180 | TF_SetStatus(status, TF_OUT_OF_RANGE, "input index out of range"); |
| 181 | return; |
| 182 | } |
| 183 | const ::tensorflow::Tensor& cc_tensor(cc_ctx->input(i)); |
| 184 | TF_Tensor* result = ::tensorflow::TF_TensorFromTensor(cc_tensor, status); |
| 185 | if (TF_GetCode(status) == TF_OK) { |
| 186 | *tensor = result; |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | void TF_SetOutput(TF_OpKernelContext* ctx, int i, const TF_Tensor* tensor, |
| 191 | TF_Status* status) { |