Beispiel #1
0
 def get_batch(self, batch_size):
     targets = np.random.randint(
         low=1,
         high=self.n,
         size=batch_size,
     )
     onehot_targets = special.to_onehot_n(targets, self.feature_dim)
     X = np.zeros((batch_size, self.sequence_length, self.feature_dim))
     X[:, :, 0] = 1  # make the target 0
     X[:, 0, :] = onehot_targets
     Y = np.zeros((batch_size, self.sequence_length, self.target_dim))
     Y[:, :, 0] = 1  # make the target 0
     Y[:, -1, :] = onehot_targets
     return X, Y
Beispiel #2
0
 def flatten_n(self, x):
     return special.to_onehot_n(x, self.n)
 def flatten_n(self, x):
     if config.TF_NN_SETTRACE:
         ipdb.set_trace()
     return special.to_onehot_n(x, self.n)
Beispiel #4
0
 def flatten_n(self, x):
     return special.to_onehot_n(x, self.n)
 def flatten_n(self, x):
     if x.shape[1] == 1:
         return special.to_onehot_n(x, self.n)
     else:
         return x