Flatten
torch.nn.modules.flatten.Flatten
Flattens a contiguous range of dims into a tensor. For use with nn.Sequential.
Shape: - Input: $(, S_{\text{start}},..., S_{i}, ..., S_{\text{end}}, )$,' where $S_{i}$ is the size at dimension $i$ and $$ means any number of dimensions including none. - Output: $(, \prod_{i=\text{start}}^{\text{end}} S_{i}, *)$.
Example:
import torch.nn
val input = torch.randn(Seq(32, 1, 5, 5))
// With default parameters
val m1 = nn.Flatten()
// With non-default parameters
val m2 = nn.Flatten(0, 2)
Value parameters
- endDim
-
last dim to flatten
- startDim
-
first dim to flatten
Attributes
- Source
- Flatten.scala
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Attributes
- Source
- Flatten.scala
Attributes
- Definition Classes
- Source
- Flatten.scala
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
- Source
- Flatten.scala
Inherited methods
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Adds a buffer to the module.
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Attributes
- Inherited from:
- Module
- Source
- Module.scala
Concrete fields
Attributes
- Source
- Flatten.scala
In this article