Skip to content

Add transpose_ layer for 2D matrix transposition in 4D Dlib tensors #3013

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2024

Conversation

Cydral
Copy link
Contributor

@Cydral Cydral commented Sep 16, 2024

This PR adds a new transpose_ layer to the Dlib deep learning framework.

The transpose_ layer performs 2D matrix transposition on each k-plane of a 4D tensor:

template <typename SUBNET>
using transpose = add_layer<transpose_, SUBNET>;

Usage example:

using net_type = loss_multiclass_log<
                    fc<number_of_classes,
                    transpose<
                    conv<16,5,5,2,2,input<matrix<float>>>
                    >>>;

This layer is useful for operations that require transposed feature maps, such as certain types of attention mechanisms or specialized convolution patterns.

@Cydral Cydral changed the title Add Transpose Layer for 2D matrix transposition in 4D tensors Add transpose_ layer for 2D matrix transposition in 4D Dlib tensors Sep 23, 2024
@davisking
Copy link
Owner

Nice, this is great. Thanks for the PR :)

@davisking davisking merged commit 90c8d78 into davisking:master Sep 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants