とすると、batch_size = 64
とする。 バッチを作成しました:batch = np.zeros((self._batch_size,), dtype=np.int64)
私は、サイズがbatch = ['o', 'w', ....'s']
で、サイズが'o'
のbatch = ['o', 'w', ....'s']
が[0,0, .... 0]
のサイズ1のホット・ベクトルで表されるとします。 したがって、バッチは依然としてbatch_sizeの形状を持ち、batch_size x vocabulary_sizeではないというような方法はありますか? BATCH_SIZE X vocabulary_sizeの寸法とPython/Numpy配列の次元の混乱
batch = np.zeros((self._batch_size,), dtype=np.int64)
temp1 = list()
for b in range(self._batch_size):
temp = np.zeros(shape=(vocabulary_size), dtype=np.int64)
temp[char2id(self._text[self._cursor[b]])] = 1.0
temp1.append(temp)
self._cursor[b] = (self._cursor[b] + 1) % self._text_size
batch = np.asarray(list)
return batch
この戻りバッチを次のように コードです。
batch = np.zeros((self._batch_size,), dtype=np.int64)
for b in range(self._batch_size):
batch[b, char2id(self._text[self._cursor[b]])] = 1.0
self._cursor[b] = (self._cursor[b] + 1) % self._text_size
return batch
このコードは、あまりにも多くのインデックスのエラーを返します。
配列サイズを[batch_size :, None]
と指定する方法はありますか?
64バッチの27個の値(0と1)をどのように表現すると思いますか?一度作成されると、配列で何をするつもりですか? – hpaulj