Input to DecodeRaw is not a multiple of 8, the size of double

博客内容涉及在使用TensorFlow时遇到的`InvalidArgumentError`,具体错误为输入到`DecodeRaw`的长度不是4的倍数。解决方案是检查`decode_raw`的类型转换,建议将数据类型改为`tf.uint8`,如果需要转换为`tf.float64`,可以先用`tf.cast`进行转换。这个错误通常出现在处理图像或音频数据时,数据预处理不正确导致。
部署运行你感兴趣的模型镜像

tensorflow.python.framework.errors_impl.InvalidArgumentError: Input to DecodeRaw has length 1 that is not a multiple of 4, the size of float
[[node DecodeRaw_1 (defined at /GraphRelated/tf_repos/keras_estimator/aaaa.py:63) ]]

解决方案一:

label = tf.decode_raw(features['label'],tf.uint8)

1

Because you use tf.decode_raw to convert your image to double(tf.float64) type, which’s size is 8 bytes. so the parsed[‘mel_spec_raw’] should be a multiple of 8. You can print the type of parsed[‘mel_spec_raw’], it should be tf.string, which explain why the size of the parsed[‘mel_spec_raw’] is 165750. Your can change your code to:

# mel_spec1d = tf.decode_raw(parsed['mel_spec_raw'], tf.float64)

mel_spec1d = tf.decode_raw(parsed[‘mel_spec_raw’], tf.uint8)
it might work, because of the size of tf.uint8 is only 1. If you want to convert the type into tf.float64, you can convert the type into tf.float using tf.cast

mel_spec1d = tf.cast(mel_spec1d, tf.float64)

Hope this will help you.

Input to DecodeRaw is not a multiple of 8, the size of double

您可能感兴趣的与本文相关的镜像

Seed-Coder-8B-Base

Seed-Coder-8B-Base

文本生成
Seed-Coder

Seed-Coder是一个功能强大、透明、参数高效的 8B 级开源代码模型系列,包括基础变体、指导变体和推理变体,由字节团队开源

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值