isdlarray - Check if object is dlarray
- MATLAB ([original](https://www.mathworks.com/help/deeplearning/ref/isdlarray.html)) ([raw](?raw))
Main Content
Check if object is dlarray
Since R2020b
Syntax
Description
`tf` = isdlarray([X](#mw%5F1ca694aa-378f-48d2-817e-a0cfefb50ef9))
returns logical 1
(true
) if X
is adlarray
, and logical 0
(false
) otherwise. You can use this function with an if
statement to avoid executing code that expects dlarray
input.
Examples
Check if Object is a dlarray
Create a 2-by-3-by-4 array of random values.
X = X(:,:,1) =
0.8147 0.1270 0.6324
0.9058 0.9134 0.0975
X(:,:,2) =
0.2785 0.9575 0.1576
0.5469 0.9649 0.9706
X(:,:,3) =
0.9572 0.8003 0.4218
0.4854 0.1419 0.9157
X(:,:,4) =
0.7922 0.6557 0.8491
0.9595 0.0357 0.9340
Check if the array is a dlarray
object.
Convert the array to dlarray
.
X = 2x3x4 dlarray
(:,:,1) =
0.8147 0.1270 0.6324
0.9058 0.9134 0.0975
(:,:,2) =
0.2785 0.9575 0.1576
0.5469 0.9649 0.9706
(:,:,3) =
0.9572 0.8003 0.4218
0.4854 0.1419 0.9157
(:,:,4) =
0.7922 0.6557 0.8491
0.9595 0.0357 0.9340
Check if the array is a dlarray
object.
Input Arguments
X
— Input variable
workspace variable
Input variable, specified as a workspace variable. X
can be any data type.
Extended Capabilities
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
The isdlarray
function fully supports GPU arrays. To run the function on a GPU, specify the input data as a gpuArray (Parallel Computing Toolbox). For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced in R2020b