diff --git a/tensorflow/c/eager/c_api.cc b/tensorflow/c/eager/c_api.cc index b34d1026e08..02a760d9f1a 100644 --- a/tensorflow/c/eager/c_api.cc +++ b/tensorflow/c/eager/c_api.cc @@ -1587,6 +1587,7 @@ void SetOpAttrValueScalar(TFE_Context* ctx, TFE_Op* op, // require TFE_Op* and just convert it internally a NameAttrValue, so // consider adding an overload to the C API to make this case easier. TFE_OpSetAttrFunction(op, attr_name, func_op); + TFE_DeleteOp(func_op); } break; case tensorflow::AttrValue::kList: TF_FALLTHROUGH_INTENDED;