Skip to content

Add reshape_to layer for flexible tensor reshaping/rescaling#3076

Merged
davisking merged 8 commits intodavisking:masterfrom
Cydral:master
May 23, 2025
Merged

Add reshape_to layer for flexible tensor reshaping/rescaling#3076
davisking merged 8 commits intodavisking:masterfrom
Cydral:master

Conversation

@Cydral
Copy link
Contributor

@Cydral Cydral commented May 6, 2025

This implements a new layer that reshapes or resizes tensors with two operation modes:

  1. Pure Reshape Mode:
  • When input/output element counts match: simple tensor reshaping without value changes.
  1. Spatial Rescaling Mode (similar to resize_to existing layer):
  • When only spatial dimensions change: uses bilinear interpolation while preserving channels.

Includes flatten alias for common flattening operations

Copy link
Owner

@davisking davisking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@davisking davisking merged commit 66be36e into davisking:master May 23, 2025
9 checks passed
davisking added a commit to kSkip/dlib that referenced this pull request May 24, 2025
…king#3076)

* Implementation of linear_ layer for neural networks. This layer provides an optimized linear transformation for multi-dimensional inputs.

* Minor change

* Update dlib/dnn/layers.h

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Add reshape_to and flatten layers to Dlib's DNN module

* Missing update to "visitors.h"

* format fixing for reshape_to

* Update dlib/test/dnn.cpp

---------

Co-authored-by: Davis E. King <davis685@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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