From 48d6179f6946dce1013fc468e11592c8086278a2 Mon Sep 17 00:00:00 2001 From: Aiqun Huang Date: Mon, 2 Nov 2015 00:18:45 -0500 Subject: [PATCH 1/3] Changed the wording of the documentation for `Reshape` Changed the wording of the documentation for `Reshape` to make it more clear. --- doc/simple.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/simple.md b/doc/simple.md index 48939396f..8e1ee9ff9 100755 --- a/doc/simple.md +++ b/doc/simple.md @@ -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 moudle will reshape all the dimensions only when the wo statements below +* `input:size(1) ~= 1` (i.e.,the size of the 1st dimension of the input is not 1.) +* `input:nElement()` equals 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: From e7a0c543d39ba2a90ff7df9d0aa7819c2b0a0c8d Mon Sep 17 00:00:00 2001 From: Aiqun Huang Date: Mon, 2 Nov 2015 00:21:22 -0500 Subject: [PATCH 2/3] fixed minor typo fixed minor typo for the documentation for `Reshape` --- doc/simple.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/simple.md b/doc/simple.md index 8e1ee9ff9..1c2dd247d 100755 --- a/doc/simple.md +++ b/doc/simple.md @@ -566,7 +566,7 @@ module = nn.Reshape(dimension1, dimension2, ... [, batchMode]) 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 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 moudle will reshape all the dimensions only when the wo statements below +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 moudle 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()` equals the product of provided sizes (i.e. `dimension1 x dimension2 x...`) From a89051c231f2d493119d551b693224eb262db506 Mon Sep 17 00:00:00 2001 From: Aiqun Huang Date: Mon, 2 Nov 2015 00:43:41 -0500 Subject: [PATCH 3/3] minor typo for documentation minor typo for documentation for `nn.Reshape` --- doc/simple.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/simple.md b/doc/simple.md index 1c2dd247d..6a5c90519 100755 --- a/doc/simple.md +++ b/doc/simple.md @@ -566,9 +566,9 @@ module = nn.Reshape(dimension1, dimension2, ... [, batchMode]) 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 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 moudle will reshape all the dimensions only when the two statements below +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()` equals the product of provided sizes (i.e. `dimension1 x dimension2 x...`) +* `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`.