How to understand learnable parameters of cwtlayer and the underlying autograd calculation
Show older comments
I was learning continuous wavelet transform (cwt) and found that there was a cwtlayer in Deep Learning Toolbox. The documentation of cwtlayer states that the dims(input) is 'CBT' and dims(output) is 'SCBT'. After I have read the source codes of cwtlayer, the crucial part of cwt calculation which is adopted from dlcwt.m shows as follows:
64 % FFT-IFFT only support unlabeled dlarrays
65 x = stripdims(x);
66 x = real(x);
67 % For this dlarray the third dimension is time
68 [C,B,~] = size(x);
69 xdft = fft(x,fftlen,3);
70 Nf = size(indices,1)-1;
71 psif = array2cwtfilters(psif,indices); % psif: reduced-weight tensor [1,1,Nr]; indices: bookkeeping matrix [Nf+1,4]
72 psif = reshape(psif,Nf,1,1,[]);
73 xdft = reshape(xdft,1,C,B,fftlen);
74 cfs = ifft(psif.*xdft,[],4);
75 if isempty(NVargs.DataFormat)
76 cfs = dlarray(cfs,'SCBT');
77 end
Through the codes illustrated above, the cwt calculation is implemented by fft-ifft along time 'T' dimension. Furthermore, the learnable parameter is reduced-weight tensor psif which is obtained from cwtfilters2array function. The reduced-weight tensor psif is a 1-by-1-by-Nr 3d tensor wherein Nr is the number of weights.
As far as I know, when training a deep neural network through backpropagation algorithm, each layer in the neural network should calculate a Jacobian
in order to utilize automatic differentiation technology (e.g., PyTorch's autograd).
in order to utilize automatic differentiation technology (e.g., PyTorch's autograd). Questions: Q1. what the meaning of reduced-weight tensor psif represents in cwt.
Q2. what is the underlying calculation method to obtain the jacobian of a 'SCBT' tensor with regard to a 1-by-1-by-Nr tensor.
Accepted Answer
More Answers (0)
Categories
Find more on Working with Signals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!