function z = gpuArray(z)
%GPUARRAY Convert to gpuArray
%   Y = GPUARRAY(X) returns a DLARRAY containing a gpuArray. This method
%   applies the gpuArray constructor to the underlying data.
%   If X is in the local workspace, its data is moved to the GPU and 
%   internally represented as a gpuArray.
%   If X is on the GPU, Y is equal to X.
%
%   See also GPUARRAY, DLARRAY/DOUBLE, DLARRAY/SINGLE.

%   Copyright 2019-2023 The MathWorks, Inc.

% If this file is modified to not be a standard unary element-wise
% function, please also remove the following template tags.
%!define $UnaryFunction gpuArray($zdata)
%!template $UnaryElementWiseTemplate
% Code generated and inserted by deep.dev.generateDlarrayMethods.

% Extract data to work on and create a template output object.
[z, fdz, zdata] = extractUnaryElwiseData(z);

zdata = gpuArray(matlab.lang.internal.move(zdata));

z = restoreUnaryElwiseData(z, ...
    matlab.lang.internal.move(fdz), ...
    matlab.lang.internal.move(zdata));
%!template
end
