python - How can use index in tensorflow?
问题描述
I have three 2-dim tensor in the training. I made like this below, but I get an error
Cannot convert an unknown Dimension to a Tensor: ?
mu = params[:, :self.num_mixture]
sigma = params[:, self.num_mixture:self.num_mixture * 2]
alpha = params[:, self.num_mixture * 2:self.num_mixture * 3]
max_alpha = tf.cast(tf.argmax(alpha, axis=1 ), 'int32')
mu = tf.gather_nd(mu,tf.stack([tf.range(max_alpha.shape[0])[...,tf.newaxis], mu[...,tf.newaxis]], axis=2))
sigma = tf.gather_nd(sigma,tf.stack([tf.range(max_alpha.shape[0])[...,tf.newaxis], sigma[...,tf.newaxis]], axis=2))
How can I fix it?
解决方案
推荐阅读
- python - 从字母系统更改的点拆分字符串
- ansible - 如何使用 Ansible “啜饮”多个文件
- android - ndk r20 ld:ld:错误:找不到-lpthread
- extbase - TYPO3 9.5 如何从存储的 FileReference 中获取文件
- docker - Do I need to add HTTPS registries to Docker daemon?
- kubernetes-helm - Helm is not deleting release
- screen - 我的代码不起作用 - tizen.power.request("SCREEN", "SCREEN_NORMAL");
- php - PHP 项目中的 Laravel 迁移
- php - 如何从附加到特定 user_id 的数据透视表中获取记录到其他表中
- c# - C#:向字符串添加不可见字符