cupy.testing.for_dtypes_combination¶
-
cupy.testing.
for_dtypes_combination
(types, names=('dtype', ), full=None)[source]¶ Decorator that checks the fixture with a product set of dtypes.
Parameters: - types (list of dtypes) – dtypes to be tested.
- names (list of str) – Argument names to which dtypes are passed.
- full (bool) – If
True
, then all combinations of dtypes will be tested. Otherwise, the subset of combinations will be tested (see the description below).
Decorator adds the keyword arguments specified by
names
to the test fixture. Then, it runs the fixtures in parallel with passing (possibly a subset of) the product set of dtypes. The range of dtypes is specified bytypes
.The combination of dtypes to be tested changes depending on the option
full
. Iffull
isTrue
, all combinations oftypes
are tested. Sometimes, such an exhaustive test can be costly. So, iffull
isFalse
, only the subset of possible combinations is tested. Specifically, at first, the shuffled lists oftypes
are made for each argument name innames
. Let the lists beD1
,D2
, …,Dn
where \(n\) is the number of arguments. Then, the combinations to be tested will bezip(D1, ..., Dn)
. Iffull
isNone
, the behavior is switched by setting the environment variableCUPY_TEST_FULL_COMBINATION=1
.For example, let
types
be[float16, float32, float64]
andnames
be['a_type', 'b_type']
. Iffull
isTrue
, then the decorated test fixture is executed with all \(2^3\) patterns. On the other hand, iffull
isFalse
, shuffled lists are made fora_type
andb_type
. Suppose the lists are(16, 64, 32)
fora_type
and(32, 64, 16)
forb_type
(prefixes are removed for short). Then the combinations of(a_type, b_type)
to be tested are(16, 32)
,(64, 64)
and(32, 16)
.