| 284 | #endif // !IS_MOBILE_PLATFORM |
| 285 | |
| 286 | tensorflow::Status OpInferSingleInputAttrs(TFE_Op* op, |
| 287 | TFE_TensorHandle* input) { |
| 288 | TFE_OpInferenceContext* ictx = op->inference_ctx.get(); |
| 289 | const auto& input_def = ictx->op_def->input_arg(ictx->input_arg_idx++); |
| 290 | if (!input_def.number_attr().empty() || !input_def.type_list_attr().empty()) { |
| 291 | // Some clients that are still setting their input attributes manually are |
| 292 | // adding input list to their op by calling `TFE_OpAddInput` for each of |
| 293 | // its elements instead of calling `TFE_OpAddInputList`. When this happens, |
| 294 | // we cannot detect the end of such list, thus lose track of the input |
| 295 | // arguments in the op definition. To guarantee backward compatibility with |
| 296 | // those clients, disable automatic inference in this case. |
| 297 | op->inference_ctx.reset(nullptr); |
| 298 | return tensorflow::Status::OK(); |
| 299 | } |
| 300 | const std::string& type_attr = input_def.type_attr(); |
| 301 | if (!type_attr.empty() && ictx->attrs.find(type_attr) == ictx->attrs.end()) { |
| 302 | op->operation.MutableAttrs()->Set(type_attr, input->handle->dtype); |
| 303 | ictx->attrs.insert(type_attr); |
| 304 | } |
| 305 | return tensorflow::Status::OK(); |
| 306 | } |
| 307 | |
| 308 | void OpInferSingleTypeInputListAttrs(TFE_Op* op, |
| 309 | const tensorflow::OpDef::ArgDef& input_def, |
no test coverage detected