📄 filt_get_sized.m
字号:
function f = filt_get_sized (f, sizes, shift, tag)% FUNCTION f = filt_get_sized (f, sizes, shift, tag)% % Sometimes, the size (x-y dimension) of the filter may not be% pre-determined or easy to calculate. In such cases, this% function produces a filter with a specified size. The input% arguement, sizes, has 3 numbers, corresponding x, y, and old% feature dimensions. For example, in the original model, the% filter from S2 to C2 is ones with the same sizes as S2. % Maximum number of nonzero afferents.max_nonzero_aff = sizes(1)*sizes(2);if length(sizes) < 3 num_new_feature = 1; sizes = [sizes 1];else num_new_feature = sizes(3); % same as num_old_feature = sizes(3)end% One way of building filters: more intuitive, but when there are% many features, one runs out of MEMORY. (because we are building% 4-D filter matrix.%%f1 = zeros(sizes(1), sizes(2), sizes(3), sizes(3));%filt_template = ones(sizes(1), sizes(2));%for i = 1:num_new_feature% f1 (:,:,i,i) = filt_template;%end%f2 = f1;%f = [];%f = filt_package (f, f1, f2, shift, tag);% This is an alternative method. We package filters by hand, and% avoid the MEMORY issue.f_template = ones(sizes(1), sizes(2), 1, 1);f_tmp = filt_package ([], f_template, f_template, shift, 's');f_value = repmat(f_tmp.f1_s, [1 sizes(3)]);f_i1 = repmat(f_tmp.i1_s, [1 sizes(3)]);f_i2 = repmat(f_tmp.i2_s, [1 sizes(3)]);idx_offset = [0:num_new_feature-1];idx_offset = repmat(idx_offset, [sizes(1)*sizes(2)+1 1]);idx_offset(end,:) = 0;f_i3 = repmat(f_tmp.i3_s,[1 sizes(3)])+idx_offset;f = setfield(f, ['f1_' tag], f_value);f = setfield(f, ['f2_' tag], f_value);f = setfield(f, ['i1_' tag], f_i1);f = setfield(f, ['i2_' tag], f_i2);f = setfield(f, ['i3_' tag], f_i3);f = setfield(f, ['size_' tag], [sizes(1:2) sizes(3) sizes(3)]);f = setfield(f, ['shift_' tag], shift);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -