在想象字幕上定义类解码器时语法无效

问题描述

这是我定义类解码器时的代码

class decoder:
    # [batch_size,IMG_EMbed_SIZE] of CNN image features
    img_embeds = tf.placeholder('float32',[None,IMG_EMbed_SIZE])
    # [batch_size,time steps] of word ids
    sentences = tf.placeholder('int32',None])
    .....       
  

问题出在这一行:

    # flatten the ground truth token ids.
    flat_ground_truth = tf.reshape(sentences[:,1:],[-1])

我的错误是:

File "<ipython-input-65-c9514f748a32>",line 57
    flat_ground_truth = tf.reshape(sentences[:,[-1]) 
                    ^
SyntaxError: invalid Syntax

感谢您的帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)