tensorflow2.0 Error when checking input: expected encode_input.......

ValueError: Error when checking input: expected encode_input to have shape (20,) but got array with shape (1,)

tensorflow2.0 Error when checking input: expected encode_input......._第1张图片

tf2.0与tf2.0以上不同,直接传入python原数据格式,eg:list会出错,改成np.array(data)

        _, result = self.encoder_emb.predict(sens_ids)

改成

        _, result = self.encoder_emb.predict(np.array(sens_ids))

你可能感兴趣的:(tensorflow,Error,tensorflow,python)