# Bi-循环神经网络

> 前面介绍的循环神经网络是单向的，每一个时刻的输出依赖于比它早的时刻的输入值，这没有利用未来时刻的信息
>
> 有些问题，当前时刻的输出不仅与过去时刻的数据有关，还与将来时刻的数据有关，如机器翻译问题
>
> 因此用两个不同的循环层分别从正向和反向对数据进行扫描，可能效果更好

基本流程：

> 正向传播时的流程为
>
> > 循环，对t = 1,..., T
> >
> > ​ 用正向循环层进行正向传播，记住每一个时刻的输出值
> >
> > 结束循环
> >
> > 循环，对t = T,..., 1
> >
> > ​ 用反向循环层进行正向传播，记住每一个时刻的输出值
> >
> > 结束循环
> >
> > 循环，对所有的t，**可按照任意顺序**进行计算
> >
> > ​ 用正向和反向循环层的输出值**拼接起来作为输出层的输入**，计算最终的输出值
> >
> > 结束循环

图

![](/files/-LqGkRnjoS30ssVQy0qK)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://im-qianuxn.gitbook.io/pytorch/ji-suan-ji/shen-du-xue-xi-li-lun/rnn/bi-rnn.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
