python-2.7 - 理解 shape=(1,) 张量
问题描述
我有一个张量“idx”,它作为下面代码的结果返回。该代码使用了另外三个名为“result”、“theta”和“user”的张量,它们都在下面的输出中描述。我对 tensorflow 很陌生,我试图了解 idx 是什么,文档对 shape=(1,) 的含义有点不清楚。是向量还是矩阵?有没有办法访问 idx 的元素?我尝试了 idx[1] 或 idx[1,] 但我得到了超出范围的错误。
非常感谢任何提示。
Code:
result
Output:
<tf.Tensor 'DVBPR_1/Add_2:0' shape=(1, 100) dtype=float32>
Code:
thetau
Output:
<tf.Variable 'DVBPR/Variable:0' shape=(20, 100) dtype=float32_ref>
Code:
user
Output:
<tf.Tensor 'Placeholder_3:0' shape=(1,) dtype=int32>
Code:
idx = tf.reduce_sum(tf.matmul(result,tf.transpose(tf.gather(thetau,user))),1)
idx
Output:
<tf.Tensor 'Sum_1:0' shape=(1,) dtype=float32>
解决方案
推荐阅读
- python-3.x - 根据 groupby 中的比例填充分类 NaN 值
- android - Android camera2 YUV 2048x1536 捕获的图像被拉伸(不是预览)
- docker - 如何为 htslib 使用 Snakemake 容器(bgzip + tabix)
- python - 使用 python 请求访问 cookie 时遇到问题
- c - 拼写错误的所有单词
- sql - 在 sas 中屏蔽名称相关问题
- nunit - 通过 nunit3-console 使用 NUnit Prefilter
- ldap - Gitlab 与 LDAP 用户过滤器的集成
- javascript - 无法向 HTML 表格添加新行
- node.js - 类似于 pandas.resample 但在 node.js [danfo.js]