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.

Antworten (1)

Matt J
Matt J am 25 Jun. 2026 um 11:16
Bearbeitet: Matt J am 25 Jun. 2026 um 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 Kommentare

@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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Produkte

Version

R2026a

Gefragt:

am 24 Jun. 2026 um 6:36

Kommentiert:

am 27 Jun. 2026 um 2:12

Community Treasure Hunt

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

Start Hunting!

Translated by