TypeError: индексы кортежа должны быть целыми или кусочками, а не кортежем - PullRequest
0 голосов
/ 25 февраля 2020

Здравствуйте, я хотел бы, чтобы вы помогли и решили мою проблему. Я использую python 3.7, в том числе Tenorsflow 2.0 Я следую за GitHub на этом шаге, когда я запускаю python, я получаю ошибку. Может кто-нибудь помочь разобраться и исправить это.

import tensorflow as tf

def dist_pair(self, pair_ixd):

    with tf.compat.v1.variable_scope("WarpedSiameseRNNDistPair") as scope:

        # unless it is the first call, then reuse the variables of the scope
        if self.is_first_dist_pair_call:
            self.is_first_dist_pair_call = False
        else:
            scope.reuse_variables()

        # T x K tensors, for T the latent time indices and K the number of RNN cells (encoder length)
        A = self.h[:, 2*pair_ixd, :]
        B = self.h[:, 2*pair_ixd+1, :]

вот ошибка, с которой я встречаюсь:

A = self.h[:, 2*pair_ixd, :]
TypeError: tuple indices must be integers or slices, not tuple
...