这里有一段代码片段。x_hat从tensorflow.python.ops.variables.RefVariable转换为tensorflow.python.framework.ops.Tensor
import tensorflow as tf
import tensorflow.contrib.slim as slim
import tensorflow.contrib.slim.nets as nets
tf.logging.set_verbosity(tf.logging.ERROR)
sess = tf.InteractiveSession()
image = tf.Variable(tf.zeros((299, 299, 3)))
x = tf.placeholder(tf.float32, shape=[None, None, None])
x_hat = image
print(type(x_hat))
noise = x_hat - x
#filter noise
x_hat = noise + x
print(type(x_hat))
基本上,xuhat是在会话中修改的(代码没有显示),修改之后,我想从xuhat中提取“noise”,修改“noise”,然后将其添加回xuhat。然而,我编写的代码将xïhat转换为Tensor,这会在以后破坏一些东西
我确信我的尝试不是实现我想要的目标的正确方法,那么你有什么建议吗
以下代码通过类型更改执行
适当的方法:
相关问题 更多 >
编程相关推荐