How is the spectralCo​nvolution1​dLayer forward computation process performed

spectralConvolution1dLayer performs convolution on 1-D input using frequency domain transformations. The layer convolves the input by using the frequency domain representation, where convolution becomes multiplication via the Fourier theorem. I want to know how the spectral convolution is performed when the 1-D input is "CBT" dlarray and the weights is NumModes-by-InputSize-by-HiddenSize dlarray.

Respuestas (1)

Matt J
Matt J el 25 de Jun. de 2026 a las 11:16
Editada: Matt J el 25 de Jun. de 2026 a las 11:18
According to the doc you referenced, the convolution is performed with respect to the time dimension in that case,
For time series and vector sequence input (data with three dimensions corresponding to the channels, observations, and time steps), the layer convolves over the time dimension.

3 comentarios

Chuguang Pan
Chuguang Pan el 26 de Jun. de 2026 a las 3:28
Editada: Torsten el 26 de Jun. de 2026 a las 15:18
@Matt J. Thanks for your answer. I want to know the internal computation details of the spectralConvolution1dLayer. How the predict/forward function of this layer is calculated. I have reviewed the spectralConvolution1dLayer.m file, however there is no concrete calculation details.
type spectralConvolution1dLayer.m
function layer = spectralConvolution1dLayer(numModes, hiddenSize, args) % Run "doc spectralConvolution1dLayer" for more information. % Copyright 2025 The MathWorks, Inc. arguments numModes (1,1) {iValidateNumModes} hiddenSize (1,1) {iValidateHiddenSize} args.Name {nnet.internal.cnn.layer.paramvalidation.validateLayerName} = '' args.Weights = [] args.WeightsInitializer = 'complex-glorot-normal' args.WeightL2Factor {iAssertValidFactor} = 1 args.WeightLearnRateFactor {iAssertValidFactor} = 1 end args.NumModes = numModes; args.HiddenSize = hiddenSize; args = nnet.internal.cnn.layer.util.gatherParametersToCPU(args); args = iConvertToCanonicalForm(args); player = nnet.internal.cnn.layer.SpectralConvolution1D(args.Name, args.NumModes, args.HiddenSize); player.LearnableParameters.L2Factor = args.WeightL2Factor; player.LearnableParameters.LearnRateFactor = args.WeightLearnRateFactor; layer = nnet.cnn.layer.SpectralConvolution1DLayer(player); layer.WeightsInitializer = args.WeightsInitializer; layer.Weights = args.Weights; end function args = iConvertToCanonicalForm(args) import nnet.internal.cnn.layer.util.convertToDouble args.HiddenSize = convertToDouble(args.HiddenSize); args.NumModes = convertToDouble(args.NumModes); args.Name = char(args.Name); end function iValidateNumModes(sz) nnet.internal.cnn.layer.paramvalidation.validateSizeParameter(sz, 'NumModes', 1); end function iValidateHiddenSize(sz) nnet.internal.cnn.layer.paramvalidation.validateSizeParameter(sz, 'HiddenSize', 1) end function iAssertValidFactor(value) nnet.internal.cnn.layer.paramvalidation.validateLearnFactor(value); end
I want to know the internal computation details
Like what? The documentation tells you it's an FFT-based convolution. What else is there to know?
@Matt J. I have find that the Solve PDE Using Fourier Neural Operator example gives the customized implementation of spectralConvolution1dLayer. The predict method presents the specific calculation process using fft and ifft. Thanks for your answer.

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2026a

Preguntada:

el 24 de Jun. de 2026 a las 6:36

Comentada:

el 27 de Jun. de 2026 a las 2:12

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by