function tf = isAnySpecifiedPvPairValueAGpuArray(pvPairNamesToCheck, varargin)
% ISANYSPECIFIEDPVPAIRVALUEGPUARRAY true if any of the input PV pair values corresponding to the PV pair names specified are a gpuArray
%   TF = isAnySpecifiedPvPairValueAGpuArray(PVPAIRNAMESTOCHECK, 'NAME1', ...
%   VAL1, 'NAME2', VAL2 ... ) returns true if any of the PV pair values
%   corresponding to the names listed in PVPAIRNAMESTOCHECK is a gpuArray.

%   Copyright 2020 The MathWorks, Inc.

% Convert all PV pair strings to chars, as this is the format expected by
% internal.stats.parseArgs.
[varargin{:}] = convertStringsToChars(varargin{:});
pvPairNamesToCheck = cellstr(pvPairNamesToCheck);
dummyDefaultValues = cell(size(pvPairNamesToCheck));
dataPVPairValues = cell(size(pvPairNamesToCheck));

% Specify extra two arguments so internal.stats.parseArgs does not error
% out for PV pairs not listed in pvPairNamesToCheck.
[dataPVPairValues{:}, ~, ~] = internal.stats.parseArgs(pvPairNamesToCheck, dummyDefaultValues, varargin{:});
tf = any(cellfun(@isgpuarray, dataPVPairValues));
end