stripdims - Remove dlarray data format - MATLAB (original) (raw)

Remove dlarray data format

Syntax

Description

The stripdims function removes the format from a dlarray object.

[Y](#mw%5F38c4c958-7b86-4725-b089-f1df1db59c88) = stripdims([X](#mw%5Fe7cfbcda-593a-46f0-afa4-357f4ec491fd%5Fsep%5Fmw%5F6f734774-5538-44ff-ad05-7e744f97893a)) returns the dlarray X without any dimension labels. Y is an unformatteddlarray.

example

[Y](#mw%5F38c4c958-7b86-4725-b089-f1df1db59c88) = stripdims([X](#mw%5Fe7cfbcda-593a-46f0-afa4-357f4ec491fd%5Fsep%5Fmw%5F6f734774-5538-44ff-ad05-7e744f97893a),[fmt](#mw%5F9bfadc07-424d-4d95-acd5-1ceca8546e7a)) additionally outputs Y with dimensions ordered according to the dimension labels in the format fmt.

example

Examples

collapse all

Create a formatted dlarray.

dlX = dlarray(randn(3,2,1,2),'SSTU')

dlX = 3(S) × 2(S) × 1(T) × 2(U) dlarray

(:,:,1,1) =

0.5377    0.8622
1.8339    0.3188

-2.2588 -1.3077

(:,:,1,2) =

-0.4336 2.7694 0.3426 -1.3499 3.5784 3.0349

Create an array that is the same as dlX but has no dimension labels.

y = 3×2×1×2 dlarray

(:,:,1,1) =

0.5377    0.8622
1.8339    0.3188

-2.2588 -1.3077

(:,:,1,2) =

-0.4336 2.7694 0.3426 -1.3499 3.5784 3.0349

Input Arguments

collapse all

Input data, specified as a formatted or unformatted dlarray object.

Description of output data dimensions, specified as a string scalar or character vector.

A data format is a string of characters, where each character describes the type of the corresponding data dimension.

The characters are:

For example, consider an array that represents a batch of sequences where the first, second, and third dimensions correspond to channels, observations, and time steps, respectively. You can describe the data as having the format "CBT" (channel, batch, time).

If fmt is empty or X is an unformatteddlarray object, then Y is equal toX. Otherwise, if X is a formatteddlarray object, then the stripdims function automatically permutes the output so that it has dimensions in the order specified byfmt. In this case, fmt must be a superset of a permutation of dims(X).

Data Types: char | string

Output Arguments

collapse all

Unformatted dlarray, returned as an unformatteddlarray object that is the same as the input arrayX, but without any dimension labels. If X is unformatted, then Y = X.

Tips

Extended Capabilities

expand all

The stripdims function supports GPU array input with these usage notes and limitations:

For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).

Version History

Introduced in R2019b