caicloud / tensorflow-tutorial

Example TensorFlow codes and Caicloud TensorFlow as a Service dev environment.
2.93k stars 2.08k forks source link

本书第2版,9.2.2节这三页的batching不是很理解,求解答 #115

Closed opfanswyx closed 5 years ago

opfanswyx commented 6 years ago

在9.2.2节中有一段话,一行代码,和一张图无法理解:

一段话:

为了计算时的并行能力,我们希望每一次计算可以对多个句子进行并行处理...

如何实现并行能力? 如何实现多个句子并行处理? 没看到有讲呀?求解....

一行代码:

num_batches = (len(id_list)-1) // (batch_size * num_step)

将数据整理成[batch_size, num_step*num_batches]的形状我理解的这个二维数组上下行之间是存在上下文联系的,但是接下来:

data_batches = np.split(data, num_batch, axis=1)

将[batch_size, num_step*num_batches]纵向的切成了num_batch个batch,这样每个batch的上下行之间不就不存在上下文联系了吗?为何这样做?以及如何对应lstm的输入层?

一张图: 就是没看懂这个图上纵向分割[batch_size, num_step*num_batches]的原因?

求助!

caicloud-bot commented 6 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so with /close.

/lifecycle stale

caicloud-bot commented 6 years ago

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

/lifecycle rotten /remove-lifecycle stale

caicloud-bot commented 5 years ago

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

/close