Summary
#563 (#595) implemented the add-when-absent half of RECONFIGURE: a qualifying hybrid @tf.function that carries no input_signature gains the inferred one (passing precondition P4). The complementary modify path — reconfiguring a decorator that already supplies an input_signature — is deferred. This issue tracks it.
Current Behavior
When HybridizationParameters.hasInputSignatureParam() is true, check() does not select RECONFIGURE; the function falls through to HAS_NO_PRIMITIVE_PARAMETERS and is left unchanged. A user-supplied signature is never overwritten, per the presence/parse three-state contract from #557.
Goal
When a function already supplies an input_signature that disagrees with the inferred one, optionally rewrite it. The policy for when to overwrite versus preserve a user-supplied signature needs to be defined and is the substance of this work.
Design
Refs
Summary
#563 (#595) implemented the add-when-absent half of
RECONFIGURE: a qualifying hybrid@tf.functionthat carries noinput_signaturegains the inferred one (passing preconditionP4). The complementary modify path — reconfiguring a decorator that already supplies aninput_signature— is deferred. This issue tracks it.Current Behavior
When
HybridizationParameters.hasInputSignatureParam()is true,check()does not selectRECONFIGURE; the function falls through toHAS_NO_PRIMITIVE_PARAMETERSand is left unchanged. A user-supplied signature is never overwritten, per the presence/parse three-state contract from #557.Goal
When a function already supplies an
input_signaturethat disagrees with the inferred one, optionally rewrite it. The policy for when to overwrite versus preserve a user-supplied signature needs to be defined and is the substance of this work.Design
RECONFIGUREtransformation, with a new passing-precondition code (e.g.P5) for the modify path, mirroring howP2andP3both reachCONVERT_TO_EAGER.getSuppliedInputSignature(), available from Parse theinput_signatureargument of@tf.functiondecorators for inference #557 and Parseinput_signaturecontent when supplied positionally #573) againstinferInputSignature(); when the policy calls for an overwrite, emit aRECONFIGUREedit that replaces the existinginput_signatureargument. The decorator-rewrite machinery from Implement theRECONFIGUREtransformation to emitinput_signature#595 extends from insertion to replacement.Refs
input_signature=[tf.TensorSpec(...)]in the refactoring's@tf.functionsource rewrite #563, Implement theRECONFIGUREtransformation to emitinput_signature#595 — the add-when-absent half and theRECONFIGUREinfrastructure.input_signatureargument of@tf.functiondecorators for inference #557, Parseinput_signaturecontent when supplied positionally #573 — parsing the supplied signature.inferInputSignaturefromOptionalto typedResult<InputSignature, AbsenceReason>#483 — a typed inference result, which may inform how preserve/overwrite decisions are modeled.