python - 将张量的 dtype(来自现有模型)从 uint8 更改为 float
问题描述
嗨,我想将 exiqting 模型的输入 dtype 从 uint8 更改为 float,我加载了模型但我不知道如何修改输入 dtype,请帮助我
def load( checkpoint_filename, input_name="images",
output_name="features"):
session = tf.compat.v1.Session()
with tf.io.gfile.GFile(checkpoint_filename, "rb") as file_handle:
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(file_handle.read())
tf.import_graph_def(graph_def, name="net")
input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
"net/%s:0" % input_name)
print(input_var.dtype.as_numpy_dtype)
load('./converttf2tflite/mars-small128TOtrt.pb')
解决方案
推荐阅读
- sql - Oracle plsql检查两侧之间的日期
- google-cloud-platform - 运行terraform申请GCP时连接被拒绝
- javascript - 保存本地存储 JavaScript 检查
- python - 如何部署训练有素的 OpenAI 健身房模型以将股票交易作为应用程序或部署到 backtrader 等回测框架中以预测买入或卖出?
- ios - 设置 UIBarButtonItem.appearance() 在 iOS 15 上不起作用
- java - 无法为轴 1.4 的 wsdl 生成代码,尽管在 SoapUI 导入时已成功使用
- javascript - 有没有办法将以下两个 Observable 组合成角度对象数组?
- sql - SQL 对数据库中的用户按收到意见最多的排序
- sql - 如何根据时间戳列仅选择在过去 3 个月内仅记录一次的这些 ID?
- android - Android Studio Java 从字符串问题尝试 JSONArray