I have a trained model where I cross every feature with a cross feature, and encode all the features using hash encoding. Here's a snippet of how I have implemented the encoding for the features:
feature_column_emb = feature_column.categorical_column_with_hash_bucket(
feature, hash_bucket_size=self.hash_bucket_size)
feature_columns.append(feature_column.indicator_column(feature_column_emb))
feature_column_cross = feature_column.crossed_column([feature, cross_feature], self.hash_bucket_size)
feature_columns.append(feature_column.indicator_column(feature_column_cross))
When I deploy this model in TF serving, and send a raw request for each of the features (eg: {"country":["USA"], "browser":["chrome"]}, "impression":["NULL"], where cross_feature would be "impression"), I get the following error:
Dense inputs should be a matrix but received shape [1,1,1] at position 0\n\t [[{{node sequential/dense_features/impression_X_country_indicator/SparseCross}}]]
I'm saving the model using predictor.save_model(model_path). Should I be doing something else to ensure that the feature cross is implemented during inference for the deployed model?