From 3f7fed5d87785797a105f15fedcec0c861887f84 Mon Sep 17 00:00:00 2001 From: albanie Date: Thu, 7 Sep 2017 11:55:59 +0100 Subject: [PATCH] mods --- README.md | 4 ++-- matlab/xtest/suite/nnaxpy.m | 0 matlab/xtest/suite/nnreshape.m | 41 ++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 matlab/xtest/suite/nnaxpy.m create mode 100644 matlab/xtest/suite/nnreshape.m diff --git a/README.md b/README.md index 2df8b81..d88ffa7 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ implementation (which uses caffe). ### Pretrained Models -Each of the Squeeze-and-Excitation networks released by the authors has been imported into MatConvNet and can be downloaded here: +Each of the Squeeze-and-Excitation networks released by the authors has been imported into [MatConvNet](https://github.com/vlfeat/matconvnet) and can be downloaded here: [SE Networks](http://www.robots.ox.ac.uk/~albanie/models.html#se-models) @@ -33,4 +33,4 @@ vl_contrib('install', 'mcnSENets') ; vl_contrib('setup', 'mcnSENets') ; ``` -**Note:** The ordering of the imagenet labels differs from the standard ordering commonly found in caffe, pytorch etc. These are remapped automically in the evaluation code. The mapping between the synsets indices can be found [here](misc/label_map.txt). \ No newline at end of file +**Note:** The ordering of the imagenet labels differs from the standard ordering commonly found in caffe, pytorch etc. These are remapped automically in the evaluation code. The mapping between the synsets indices can be found [here](misc/label_map.txt). diff --git a/matlab/xtest/suite/nnaxpy.m b/matlab/xtest/suite/nnaxpy.m new file mode 100644 index 0000000..e69de29 diff --git a/matlab/xtest/suite/nnreshape.m b/matlab/xtest/suite/nnreshape.m new file mode 100644 index 0000000..8501d39 --- /dev/null +++ b/matlab/xtest/suite/nnreshape.m @@ -0,0 +1,41 @@ +classdef nnreshape < nntest + methods (Test) + + function basicWithMinus(test) + sz = [3,3,5,10] ; + x = test.randn(sz) ; + dim = {9,[],5} ; + + y = vl_nnreshape(x, dim) ; + targets = [9,1,5,10] ; + osz = size(y) ; + for i = 1:numel(targets) + assert(osz(i) == targets(i)) ; + end + + % check derivatives with numerical approximation + dzdy = test.randn(size(y)) ; + dzdx = vl_nnreshape(x, dim, dzdy) ; + test.der(@(x) vl_nnreshape(x, dim), x, dzdy, dzdx, 1e-3*test.range) ; + end + + function basicWithZero(test) + sz = [3,3,5,10] ; + x = test.randn(sz) ; + dim = {[],3,5} ; + + y = vl_nnreshape(x, dim) ; + targets = [3,3,5,10] ; + osz = size(y) ; + for i = 1:numel(targets) + assert(osz(i) == targets(i)) ; + end + + % check derivatives with numerical approximation + dzdy = test.randn(size(y)) ; + dzdx = vl_nnreshape(x, dim, dzdy) ; + test.der(@(x) vl_nnreshape(x, dim), x, dzdy, dzdx, 1e-3*test.range) ; + end + + end +end