Tensorflow-Feature Column遇到的坑
来源:互联网 发布:asp连接sql数据库 编辑:程序博客网 时间:2024/06/06 02:07
在使用特征交叉函数
tf.contrib.layers.crossed_column([user_age, item_age], hash_bucket_size=100),
训练时出错:
InvalidArgumentError (see above for traceback): Dense inputs should be a matrix but received shape [1000] at position 0
[[Node: wide_and_deep_model/wide_model/weighted_sum_from_feature_columns/cross = SparseFeatureCross[N=0, dense_types=[DT_STRING, DT_STRING], hashed_output=true, internal_type=DT_STRING, num_buckets=100, out_type=DT_INT64, sparse_types=[], _device="/job:localhost/replica:0/task:0/cpu:0"](strided_slice_9, strided_slice)]]
分析:
数据维度不匹配,输入特征需要一个2D的tensor,提供的是1D的tensor,在不交叉时可能隐藏了这个问题,交叉时报错。
解决:扩展一个维度
examples_dict = {}for n, header in enumerate(COLUMNS): examples_dict[header] = example_batch[:, n]
改为
examples_dict = {}for n, header in enumerate(COLUMNS): examples_dict[header] = tf.expand_dims(example_batch[:, n], 1)
阅读全文
0 0
- Tensorflow-Feature Column遇到的坑
- TensorFlow 中遇到的坑
- Tensorflow中权值和feature map的可视化
- tensorflow安装过程中遇到的坑
- 安装tensorflow过程中遇到的坑
- ubuntu14.04安装tensorflow遇到的坑
- Tensorflow搭建中遇到的坑
- tensorflow 遇到的问题
- 遇到的问题----Column length too big for column
- 深度神经网络Tensorflow里卷积后feature map的大小
- 安装tensorflow遇到的问题
- tensorflow可视化遇到的问题
- tensorflow笔记: 遇到的问题
- 学习tensorflow遇到的问题
- 安装Tensorflow遇到的问题
- 初学tensorflow遇到的问题
- install tensorflow 遇到的问题
- tensorflow-gpu遇到的问题
- iOS平台5+SDK集成
- 【Qt开发】Qt5.9安装
- Nutch2.2.1之MySQL数据库的配置和建表webpage语句
- MyFirstArticle
- 聊聊ctrl+c和ctrl+z的区别
- Tensorflow-Feature Column遇到的坑
- dict
- C# png格式图像转jpg时透明背景变为黑色问题
- require()和include()的区别验证
- 标准日期、中国标准时间、时间戳、毫秒数互转
- 关于在非activity类里面调用startActivty和startActivityForResult
- 《Error:Execution failed for task ':app:transformNative_libsWithStripDebugSymb》
- spring.data.jpa.query :Cannot use native queries with dynamic sorting and/or pagination in method
- zy