how to sort dlarrays

1 回表示 (過去 30 日間)
feynman feynman
feynman feynman 2022 年 12 月 4 日
コメント済み: Xiaoke 2024 年 9 月 13 日
How to sort dlarrays like in
sort(a)
, where a is a numeric array? Is there a way of sorting next(mbq) by specifying some options in the following code?
mbq = minibatchqueue(ads,MiniBatchSize=miniBatchSize,MiniBatchFormat="BC");
next(mbq)
  1 件のコメント
feynman feynman
feynman feynman 2022 年 12 月 19 日
?

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

採用された回答

Aritra
Aritra 2023 年 3 月 20 日
As per my understanding you are trying to sort a "dlarray" using the "sort" function.
A "dlarray" is a deep learning array designed to store data with optional data format labels for custom training loops. It also enables functions to compute and use derivatives through automatic differentiation.
However, to sort a "dlarray" you must initially convert it to a double array using the "extractdata" function. You can then use the "sort" function to sort the double array. The following code describes the same:
X = randn(1,5);
dlX = dlarray(X);
t = extractdata(dlX);
sort(t);
For detail, please see this MathWorks documentation below for more information on sorting multi-dimensional arrays: https://in.mathworks.com/help/matlab/ref/double.sortrows.html#d124e1400369
  1 件のコメント
Xiaoke
Xiaoke 2024 年 9 月 13 日
But this cannot be backpropagated like torch.sort, is there any solution?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCustom Training Loops についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by