You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用TensorFlow.js转换TensorFlow模型后加载失败的问题求助

TensorFlow.js转换TensorFlow模型后加载失败的问题求助

我最近在尝试把一个简单的CNN模型转换成TensorFlow.js格式,模型转换过程看起来是成功的,但加载的时候总是报错:

'An InputLayer should be passed either a batchInputShape or an inputShape.'

我用了这两种方式导出并转换模型:

tf.saved_model.save(model, 'my_model')

import tensorflowjs as tfjs
tfjs.converters.save_keras_model(model, 'tfjs')

我还试过从.h5和.keras两种格式的模型文件来转换,有时候还会遇到和模型配置相关的其他错误。
几个月前我转换过类似的模型,完全没出过问题,有没有大佬知道这是怎么回事呀?

备注:内容来源于stack exchange,提问作者program1232123

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 12:03:06