【发布时间】:2021-01-13 18:00:44
【问题描述】:
我正在寻找 GAN 模型的损失函数,然后 this one 出来了:
gd_loss = tf.reduce_sum(tf.square(tf.abs(dx_real) - tf.abs(dx_fake))) + \
tf.reduce_sum(tf.square(tf.abs(dy_real) - tf.abs(dy_fake))) + \
tf.reduce_sum(tf.square(tf.abs(dz_real) - tf.abs(dz_fake)))
但我想将以下内容转换为 PyTorch,因为我使用的是 PyTorch 张量:
dx_real = t_target_image[:, 1:, :, :, :] - t_target_image[:, :-1, :, :, :]
t_target_image 是 TensorFlow 中的张量。
我该怎么做?
【问题讨论】:
标签: tensorflow pytorch tensor code-conversion