Clear Filters
Clear Filters

Is there a supported method for fully connected layers with dlarrays containing complex numbers (2021b)?

1 view (last 30 days)
In the 2021b release of the Deep Learning toolbox, Matlab added additional support for using complex values within a dlarray. Unfortunately fully connected operations are not supported for complex numbers as part of this release. Is there a supported method of performing matrix multiplies with dlarrays containing complex numbers that will work within a custom training loop with dlfeval? Additionally, is this capability coming in the future?

Answers (1)

Aditya
Aditya on 21 Feb 2024
Deep Learning Toolbox in the 2021b release indeed introduced support for complex values in dlarray objects. However, certain operations, such as fully connected layers, did not support complex numbers directly.
To perform matrix multiplication with dlarray objects containing complex numbers within a custom training loop that uses dlfeval, you can manually implement the matrix multiplication using lower-level operations that do support complex numbers. For example, you can use the mtimes function for matrix multiplication, which is supported for complex dlarray objects:
% Suppose A and B are dlarray objects with complex values
A = dlarray(complexA); % complexA contains complex values
B = dlarray(complexB); % complexB contains complex values
% Perform matrix multiplication
C = mtimes(A, B);
In the custom training loop, you can then use the result of this multiplication as part of your forward pass and gradient computation.

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!