Check gpuArray double or single?

조회 수: 4 (최근 30일)
covariant_cat
covariant_cat 2017년 11월 27일
댓글: Steven Lord 2017년 11월 27일
I'm pretty sure a gpuArray has a type (e.g., single or double). But i'm not sure how to check it. The function isa does not work for gpuArray.
A = gpuArray(single(1));
B = gpuArray(double(1));
isa(B,'double')
isa(B,'single')
You get both 0s.
Ref: https://www.mathworks.com/help/matlab/ref/isa.html
Thanks!

답변 (1개)

Steven Lord
Steven Lord 2017년 11월 27일
The isa function works fine, but it answers a different question than you want to be answered. Instead, ask your question using the classUnderlying function.
  댓글 수: 2
Joss Knight
Joss Knight 2017년 11월 27일
isaUnderlying is the direct analogue.
Steven Lord
Steven Lord 2017년 11월 27일
Right, classUnderlying came to my mind first and I forgot to check for a function that is to isa like classUnderlying is to class. Use isaUnderlying as Joss suggested.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by