Commit 2e01032 1 parent 590a775 commit 2e01032 Copy full SHA for 2e01032
File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ function Reshape:__init(...)
6
6
7
7
self .size = torch .LongStorage ()
8
8
self .batchsize = torch .LongStorage ()
9
+ if torch .type (arg [# arg ]) == ' boolean' then
10
+ self .batchMode = arg [# arg ]
11
+ table.remove (arg , # arg )
12
+ end
9
13
local n = # arg
10
14
if n == 1 and torch .typename (arg [1 ]) == ' torch.LongStorage' then
11
15
self .size :resize (# arg [1 ]):copy (arg [1 ])
@@ -35,7 +39,10 @@ function Reshape:updateOutput(input)
35
39
input = self ._input
36
40
end
37
41
38
- if input :nElement () == self .nelement then
42
+ if (self .batchMode == false ) or (
43
+ (self .batchMode == nil ) and
44
+ (input :nElement () == self .nelement and input :size (1 ) ~= 1 )
45
+ ) then
39
46
self .output :view (input , self .size )
40
47
else
41
48
self .batchsize [1 ] = input :size (1 )
You can’t perform that action at this time.
0 commit comments