Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewording the documentation for nn.Reshape #453

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions doc/simple.md
Original file line number Diff line number Diff line change
Expand Up @@ -564,9 +564,13 @@ module = nn.Reshape(dimension1, dimension2, ... [, batchMode])
```


Reshapes an `nxpxqx..` Tensor into a `dimension1xdimension2x...` Tensor, taking the elements column-wise.
Reshapes an `n x p x q x..` Tensor into a `dimension1 x dimension2 x...` Tensor, taking the elements column-wise.

The optional last argument `batchMode`, when `true` forces the first dimension of the input to be considered the batch dimension, and thus keep its size fixed. This is necessary when dealing with batch sizes of one. When `false`, it forces the entire input (including the first dimension) to be reshaped to the input size. Default `batchMode=nil`, which means that the module considers inputs with more elements than the produce of provided sizes, i.e. `dimension1xdimension2x...`, to be batches.
The optional last argument `batchMode`, when `true` forces the first dimension of the input to be considered as the batch dimension (i.e., the size of the first dimension will be treated as the batch size), and thus keep the size of the first dimension fixed and only reshape the other dimensions. When `false`, it forces the entire input (including the first dimension) to be reshaped to the input size. The default for `batchMode` is `nil`, which means that this module will reshape all the dimensions only when the two statements below
* `input:size(1) ~= 1` (i.e.,the size of the 1st dimension of the input is not 1.)
* `input:nElement() == ` the product of provided sizes (i.e. `dimension1 x dimension2 x...`)

both are true, and in all other cases this module behaves the same as `batchMode = true`.

Example:

Expand Down