Suppose batch_size = 64.
I created a batch : batch = np.zeros((self._batch_size,), dtype=np.int64). Suppose I have batch of chars such that batch = ['o', 'w', ....'s'] of 64 size and 'o' will be represented as [0,0, .... 0] 1-hot vector of size 27.
So, is there any way such that batch will still have shape of batch_size and not batch_size x vocabulary_size?
Code is as follows :
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
This return batch as dimension of batch_size x vocabulary_size.
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
This code returns an error of too many few indices.
Is there any way of specifying array size as [batch_size :, None]?