estimator icon indicating copy to clipboard operation
estimator copied to clipboard

copy of input_receiver.features

Open wu-yy opened this issue 2 years ago • 2 comments

deepcopy of input_receiver.features avoid changing input_receiver.features in model_fn

wu-yy avatar Aug 26 '22 07:08 wu-yy

Thanks for the PR!

I think this counts as a shallow copy, since the values aren't being copied before being added to the new dict. You could replace the loop and use: copy.copy(input_receiver.features)

Also, is there an issue associated with this change? Typically, the input_receiver_fn produces a new features dict that isn't used anywhere else, which is why modifications to it would be generally acceptable. (but for code cleanliness, I agree that making a copy before passing it to the model function is better).

k-w-w avatar Sep 07 '22 17:09 k-w-w

@k-w-w thanks for your reply, We encountered this problem because the incoming features were modified in model_fn, so, the placeholder which in savdemodel is not matched the input_receiver_fn. I will change the PR and use copy.copy(input_receiver.features).

wu-yy avatar Sep 30 '22 06:09 wu-yy

Hi @k-w-w Can you please review this PR ? Thank you!

gbaned avatar Dec 16 '22 13:12 gbaned

No more updates to Estimator, except to ensure compat with TF releases, when needed

mihaimaruseac avatar Aug 02 '23 23:08 mihaimaruseac