File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
pkg/workloads/cortex/tf_api Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -150,11 +150,17 @@ def create_raw_prediction_request(sample):
150
150
prediction_request .model_spec .signature_name = signature_key
151
151
152
152
for column_name , value in sample .items ():
153
- shape = [1 ]
154
153
if util .is_list (value ):
155
154
shape = [len (value )]
155
+ for dim in signature_def [signature_key ]["inputs" ][column_name ]["tensorShape" ]["dim" ][
156
+ 1 :
157
+ ]:
158
+ shape .append (int (dim ["size" ]))
159
+ else :
160
+ shape = [1 ]
161
+ value = [value ]
156
162
sig_type = signature_def [signature_key ]["inputs" ][column_name ]["dtype" ]
157
- tensor_proto = tf .make_tensor_proto ([ value ] , dtype = DTYPE_TO_TF_TYPE [sig_type ], shape = shape )
163
+ tensor_proto = tf .make_tensor_proto (value , dtype = DTYPE_TO_TF_TYPE [sig_type ], shape = shape )
158
164
prediction_request .inputs [column_name ].CopyFrom (tensor_proto )
159
165
160
166
return prediction_request
You can’t perform that action at this time.
0 commit comments