mindspore/docs/api/api_python/nn/mindspore.nn.TimeDistribute...

26 lines
1.1 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mindspore.nn.TimeDistributed
==============================
.. py:class:: mindspore.nn.TimeDistributed(layer, time_axis, reshape_with_axis=None)
时间分布层。
TimeDistributed是一个封装层它允许将一个层应用到输入的每个时间切片。 `x` 至少是三维。执行中有两种情况。当提供 `reshape_with_axis`选择reshape方法会更高效否则将使用沿 `time_axis` 划分输入的方法这种方法更通用。比如在处理BN时无法提供 `reshape_with_axis`
**参数:**
- **layer** (Union[Cell, Primitive]) - 指定将被包裹的 :class:`mindspore.nn.Cell`:class:`mindspore.ops.Primitive`
- **time_axis** (int) - 指定各个时间切片上的轴。
- **reshape_with_axis** (int) - 将使用 `time_axis` 调整该轴。默认值None。
**输入:**
- **x** (Tensor) - shape为 :math:`(N, T, *)` 的Tensor。其中 :math:`*` 表示任意数量的附加维度。
**输出:**
shape为 :math:`(N, T, *)` 的Tensor。
**异常:**
- **TypeError** - layer既不是 :class:`mindspore.nn.Cell` 也不是 :class:`mindspore.ops.Primitive`