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.

回答 (1 件)

Matt J
Matt J 2026 年 6 月 25 日 11:16
編集済み: Matt J 2026 年 6 月 25 日 11:18

0 投票

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 件のコメント

Chuguang Pan
Chuguang Pan 2026 年 6 月 26 日 3:28
編集済み: Torsten 2026 年 6 月 26 日 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
Matt J
Matt J 2026 年 6 月 26 日 15:14
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?
Chuguang Pan
Chuguang Pan 2026 年 6 月 27 日 2:12
@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.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeImage Data Workflows についてさらに検索

製品

リリース

R2026a

質問済み:

2026 年 6 月 24 日 6:36

コメント済み:

2026 年 6 月 27 日 2:12

Community Treasure Hunt

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

Start Hunting!

Translated by