Given this function, I'm able to let my model accept incoming ExampleListWithContext message, but I want it to also accept message in TFExample format. How could I reach this?
def build_ELWC_parsing_serving_input_receiver_fn(self,
default_batch_size=None,
input_name="inputs"):
shared_feature_spec, example_feature_spec = self.create_feature_spec_for_elwc()
def serving_input_receiver_fn():
"""An input_fn that expects a serialized ExampleListWithContext."""
serialized_elwc_tensor = tf.compat.v1.placeholder(
dtype=tf.dtypes.string,
shape=[default_batch_size],
name="input_elwc_tensor",
)
receiver_tensors = {input_name: serialized_elwc_tensor}
features = parse_from_example_list(
serialized_elwc_tensor,
context_feature_spec=shared_feature_spec,
example_feature_spec=example_feature_spec,
)
return ServingInputReceiver(features, receiver_tensors)
return serving_input_receiver_fn
question from:
https://stackoverflow.com/questions/65948459/how-to-enable-servinginputreceiver-to-accept-and-parse-serialized-examples-in-di 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…