diff options
author | Zhao Zhili <zhilizhao@tencent.com> | 2023-04-30 23:39:00 +0800 |
---|---|---|
committer | Zhao Zhili <zhilizhao@tencent.com> | 2023-06-08 10:50:24 +0800 |
commit | d9f41a343ef9f77fa0d0485f1ea134837b101085 (patch) | |
tree | ca9a55c8b44cf53565ffef5134aa19d6beaddf19 /libavfilter/dnn | |
parent | f3495ef4f88a01e2bf4481244b31a650830c65c0 (diff) | |
download | ffmpeg-d9f41a343ef9f77fa0d0485f1ea134837b101085.tar.gz |
avfilter/dnn_backend_tf: check TF_OperationOutputType return value
This also fixed a warning: implicit conversion from enumeration
type 'TF_DataType' (aka 'enum TF_DataType') to different
enumeration type 'DNNDataType'.
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
Diffstat (limited to 'libavfilter/dnn')
-rw-r--r-- | libavfilter/dnn/dnn_backend_tf.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/libavfilter/dnn/dnn_backend_tf.c b/libavfilter/dnn/dnn_backend_tf.c index 74fe06d6fb..552a9f2fa1 100644 --- a/libavfilter/dnn/dnn_backend_tf.c +++ b/libavfilter/dnn/dnn_backend_tf.c @@ -274,6 +274,7 @@ static int get_input_tf(void *model, DNNData *input, const char *input_name) TFModel *tf_model = model; TFContext *ctx = &tf_model->ctx; TF_Status *status; + TF_DataType dt; int64_t dims[4]; TF_Output tf_output; @@ -284,7 +285,18 @@ static int get_input_tf(void *model, DNNData *input, const char *input_name) } tf_output.index = 0; - input->dt = TF_OperationOutputType(tf_output); + dt = TF_OperationOutputType(tf_output); + switch (dt) { + case TF_FLOAT: + input->dt = DNN_FLOAT; + break; + case TF_UINT8: + input->dt = DNN_UINT8; + break; + default: + av_log(ctx, AV_LOG_ERROR, "Unsupported output type %d in model\n", dt); + return AVERROR(EINVAL); + } input->order = DCO_RGB; status = TF_NewStatus(); |