Я работаю с дифференцируемым деревом решений для набора данных KDD99. Когда я выполняю приведенный ниже фрагмент кода, я получаю tensorflow.python.framework.errors_impl.InvalidArgumentError
# Input X, output Y
self.X = tf.placeholder("float", [N_BATCH, 8, 8, 1], name='X')
self.Y = tf.placeholder("float", [N_BATCH, N_LABEL], name='Y')
in_repeat = in_repeat / 2
out_repeat = out_repeat * 2
# Again define the indices that picks d and 1-d for the node
batch_0_indices = \
tf.tile(tf.expand_dims(tf.range(0, N_BATCH * N_LEAF, N_LEAF), 1),
[1, N_LEAF])
batch_complement_indices = \
np.array([[0] * int(in_repeat), [N_BATCH * N_LEAF] * int(in_repeat)]
* out_repeat).reshape(N_BATCH, N_LEAF)
```mu_e_update = []
for mu, flat_decision_p in zip(self.mu_e, self.flat_decision_p_e):
mu = tf.multiply(mu, tf.gather(flat_decision_p,
tf.add(batch_indices, batch_complement_indices)))
mu_e_update.append(mu)
self.mu_e = mu_e_update```
Load, transform and slit KDD99 dataset
dataset = dataset.values
X = dataset[:, :-1], y = dataset[:, -1]
scaler = RobustScaler()
Xb = scaler.fit_transform(X)
data_X = np.pad(Xb, ((0, 0), (0, 64 - len(Xb[0]))), 'constant').reshape(-1, 8, 8, 1)
encoder = LabelEncoder().fit(y)
encoded_Y = encoder.transform(y)
# convert integers to dummy variables (i.e. one hot encoded)
data_y = np_utils.to_categorical(encoded_Y)
trX, teX, trY, teY = train_test_split(data_X, data_y, test_size=0.3)
И я получаю эту ошибку
tensorflow.python.framework.errors_impl.InvalidArgumentError: indices[0,1] = 2055 is not in [0, 256) [[node GatherV2_16 (defined at \Users\Benji\Anaconda2\envs\ben\lib\site-packages\tensorflow_core\python\framework\ops.py:1748) ]]
...
File "/Users/Benji/PycharmProjects/Code/NEWWORK6.py", line 190, in init
tf.add(batch_indices, batch_complement_indices)))