Skip to content

Commit 565354c

Browse files
authored
fix the imprecise description (d2l-ai#1168)
Co-authored-by: yuande <yuande>
1 parent 27d59a4 commit 565354c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

chapter_recurrent-neural-networks/sequence.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -424,23 +424,23 @@ max_steps = 64
424424
```{.python .input}
425425
#@tab mxnet, pytorch
426426
features = d2l.zeros((T - tau - max_steps + 1, tau + max_steps))
427-
# 列i(i<tau)是来自x的观测,其时间步从(i+1)到(i+T-tau-max_steps+1)
427+
# 列i(i<tau)是来自x的观测,其时间步从(i)到(i+T-tau-max_steps+1)
428428
for i in range(tau):
429429
features[:, i] = x[i: i + T - tau - max_steps + 1]
430430
431-
# 列i(i>=tau)是来自(i-tau+1)步的预测,其时间步从(i+1)到(i+T-tau-max_steps+1)
431+
# 列i(i>=tau)是来自(i-tau+1)步的预测,其时间步从(i)到(i+T-tau-max_steps+1)
432432
for i in range(tau, tau + max_steps):
433433
features[:, i] = d2l.reshape(net(features[:, i - tau: i]), -1)
434434
```
435435

436436
```{.python .input}
437437
#@tab tensorflow
438438
features = tf.Variable(d2l.zeros((T - tau - max_steps + 1, tau + max_steps)))
439-
# 列i(i<tau)是来自x的观测,其时间步从(i+1)到(i+T-tau-max_steps+1)
439+
# 列i(i<tau)是来自x的观测,其时间步从(i)到(i+T-tau-max_steps+1)
440440
for i in range(tau):
441441
features[:, i].assign(x[i: i + T - tau - max_steps + 1].numpy())
442442
443-
# 列i(i>=tau)是来自(i-tau+1)步的预测,其时间步从(i+1)到(i+T-tau-max_steps+1)
443+
# 列i(i>=tau)是来自(i-tau+1)步的预测,其时间步从(i)到(i+T-tau-max_steps+1)
444444
for i in range(tau, tau + max_steps):
445445
features[:, i].assign(d2l.reshape(net((features[:, i - tau: i])), -1))
446446
```

chapter_recurrent-neural-networks/sequence_origin.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,12 @@ max_steps = 64
355355
#@tab mxnet, pytorch
356356
features = d2l.zeros((T - tau - max_steps + 1, tau + max_steps))
357357
# Column `i` (`i` < `tau`) are observations from `x` for time steps from
358-
# `i + 1` to `i + T - tau - max_steps + 1`
358+
# `i` to `i + T - tau - max_steps + 1`
359359
for i in range(tau):
360360
features[:, i] = x[i: i + T - tau - max_steps + 1].T
361361
362362
# Column `i` (`i` >= `tau`) are the (`i - tau + 1`)-step-ahead predictions for
363-
# time steps from `i + 1` to `i + T - tau - max_steps + 1`
363+
# time steps from `i` to `i + T - tau - max_steps + 1`
364364
for i in range(tau, tau + max_steps):
365365
features[:, i] = d2l.reshape(net(features[:, i - tau: i]), -1)
366366
```
@@ -369,12 +369,12 @@ for i in range(tau, tau + max_steps):
369369
#@tab tensorflow
370370
features = tf.Variable(d2l.zeros((T - tau - max_steps + 1, tau + max_steps)))
371371
# Column `i` (`i` < `tau`) are observations from `x` for time steps from
372-
# `i + 1` to `i + T - tau - max_steps + 1`
372+
# `i` to `i + T - tau - max_steps + 1`
373373
for i in range(tau):
374374
features[:, i].assign(x[i: i + T - tau - max_steps + 1].numpy().T)
375375
376376
# Column `i` (`i` >= `tau`) are the (`i - tau + 1`)-step-ahead predictions for
377-
# time steps from `i + 1` to `i + T - tau - max_steps + 1`
377+
# time steps from `i` to `i + T - tau - max_steps + 1`
378378
for i in range(tau, tau + max_steps):
379379
features[:, i].assign(d2l.reshape(net((features[:, i - tau: i])), -1))
380380
```

0 commit comments

Comments
 (0)