diff options
author | Clement Farabet <clement.farabet@gmail.com> | 2011-08-03 05:50:09 +0400 |
---|---|---|
committer | Clement Farabet <clement.farabet@gmail.com> | 2011-08-03 05:50:09 +0400 |
commit | d1924964e4743e4da165b7eb2b12edd6d26f8e37 (patch) | |
tree | e74fb9f26959185dacfaed9ec4b8923e5b3b2bbb /SpatialFovea.lua | |
parent | 86b6cb4fc2c29e1232a1c70a38ae82d23260f615 (diff) |
Smarter hash for SpatialFovea ?
Diffstat (limited to 'SpatialFovea.lua')
-rw-r--r-- | SpatialFovea.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/SpatialFovea.lua b/SpatialFovea.lua index 26dbf55..deaba65 100644 --- a/SpatialFovea.lua +++ b/SpatialFovea.lua @@ -137,8 +137,10 @@ function SpatialFovea:forward(input) -- create or reuse list of cached inputs self.cachedPreProcessed = self.cachedPreProcessed or {} - -- the norm of the input should be enough to serve as a solid hash - hash = tostring(input:sum()) + -- compute an abritrary hash, should be strong enough + tohash = input:narrow(2,1,math.min(input:size(2),32)):narrow(3,1,math.min(input:size(3),32)) + hash = tostring(tohash:sum()) + hash = hash .. tostring(tohash:std()) -- check if input was seend before if self.cachedPreProcessed[hash] then |