def generate_batch(seq_length, batch_size, min_val, max_val):
"""
Generates batch of examples.
:param seq_length: length of the sequence to be generated
:param batch_size: number of samples in the batch
:param min_val: minimum value for a
:param max_val: maximum value for a
:return x: batch of examples
:return y: batch of ground truth values
"""
n_elems = 2
x = np.empty((batch_size, seq_length, n_elems))
y = np.empty((batch_size, 1))
for i in range(batch_size):
sample, ground_truth = generate_example(seq_length, min_val, max_val)
x[i, :, :] = sample
y[i, 0] = ground_truth
return x, y
01_adding_task.py 文件源码
python
阅读 37
收藏 0
点赞 0
评论 0
评论列表
文章目录