Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit dcdac97

Browse files
committed
enable for windows
1 parent 153d93f commit dcdac97

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

src/operator/tensor/broadcast_reduce-inl.cuh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,6 @@ void Reduce(Stream<gpu> *s, const TBlob& small, const OpReqType req,
619619
ReduceImplConfig<ndim> config =
620620
ConfigureReduceImpl<ndim, DType>(small.shape_, big.shape_, NULL, NULL);
621621
if (safe_acc) {
622-
// TODO(haojin2): Use real-only type swtich for windows temporarily due to CI issues.
623-
#ifndef _WIN32
624622
MXNET_ACC_TYPE_SWITCH(mshadow::DataType<DType>::kFlag, DataType, AType, {
625623
typedef typename std::conditional<safe_acc, AType, DataType>::type AccType;
626624
MSHADOW_TYPE_SWITCH(small.type_flag_, OType, {
@@ -630,17 +628,6 @@ void Reduce(Stream<gpu> *s, const TBlob& small, const OpReqType req,
630628
stream, small, req, big, workspace, config);
631629
});
632630
});
633-
#else
634-
MXNET_REAL_ACC_TYPE_SWITCH(mshadow::DataType<DType>::kFlag, DataType, AType, {
635-
typedef typename std::conditional<safe_acc, AType, DataType>::type AccType;
636-
MSHADOW_TYPE_SWITCH(small.type_flag_, OType, {
637-
typedef typename std::conditional<safe_acc, OType, DataType>::type OutType;
638-
config = ConfigureReduceImpl<ndim, AccType>(small.shape_, big.shape_, NULL, NULL);
639-
ReduceImpl<Reducer, ndim, AccType, DataType, OutType, OP>(
640-
stream, small, req, big, workspace, config);
641-
});
642-
});
643-
#endif
644631
} else {
645632
ReduceImpl<Reducer, ndim, DType, DType, DType, OP>(stream, small, req, big, workspace, config);
646633
}

src/operator/tensor/broadcast_reduce-inl.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,6 @@ void Reduce(Stream<cpu>* s, const TBlob& small, const OpReqType req,
241241
N, M, req == kAddTo, big.dptr<DType>(), small.dptr<DType>(),
242242
big.shape_.get<ndim>(), small.shape_.get<ndim>(), rshape, rstride);
243243
} else {
244-
// TODO(haojin2): Use real-only type swtich for windows temporarily due to CI issues.
245-
#ifndef _WIN32
246244
MXNET_ACC_TYPE_SWITCH(mshadow::DataType<DType>::kFlag, DataType, AType, {
247245
typedef typename std::conditional<safe_acc, AType, DataType>::type AccType;
248246
MSHADOW_TYPE_SWITCH_WITH_BOOL(small.type_flag_, OType, {
@@ -252,17 +250,6 @@ void Reduce(Stream<cpu>* s, const TBlob& small, const OpReqType req,
252250
big.shape_.get<ndim>(), small.shape_.get<ndim>(), rshape, rstride);
253251
});
254252
});
255-
#else
256-
MXNET_REAL_ACC_TYPE_SWITCH(mshadow::DataType<DType>::kFlag, DataType, AType, {
257-
typedef typename std::conditional<safe_acc, AType, DataType>::type AccType;
258-
MSHADOW_TYPE_SWITCH_WITH_BOOL(small.type_flag_, OType, {
259-
typedef typename std::conditional<safe_acc, OType, DataType>::type OutType;
260-
seq_reduce_compute<Reducer, ndim, AccType, DataType, OutType, OP>(
261-
N, M, req == kAddTo, big.dptr<DataType>(), small.dptr<OutType>(),
262-
big.shape_.get<ndim>(), small.shape_.get<ndim>(), rshape, rstride);
263-
});
264-
});
265-
#endif
266253
}
267254
}
268255

tests/python/unittest/test_numpy_op.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ def hybrid_forward(self, F, a, *args, **kwargs):
614614
def is_int(dtype):
615615
return 'int' in dtype
616616

617+
is_windows = sys.platform.startswith('win')
617618
in_data_dim = random.choice([2, 3, 4])
618619
shape = rand_shape_nd(in_data_dim, dim=3)
619620
acc_type = {'float16': 'float32', 'float32': 'float64', 'float64': 'float64',
@@ -667,15 +668,19 @@ def is_int(dtype):
667668
test_mean.hybridize()
668669

669670
if itype == 'bool':
670-
x = np.random.uniform(size=shape) > 0.5
671+
x = np.array(_np.random.uniform(size=shape) > 0.5)
671672
else:
672673
x = np.random.uniform(-128, 127, size=shape).astype(itype)
673674

674675
expected_ret = _np.mean(x.asnumpy(), axis=axis, dtype=dtype, keepdims=keepdims)
675-
y = test_mean(x)
676-
assert y.shape == expected_ret.shape
677-
assert_almost_equal(y.asnumpy(), expected_ret, rtol=1e-3 if dtype == 'float16' else 1e-3,
678-
atol=1e-5 if dtype == 'float16' else 1e-5)
676+
677+
if itype == 'bool':
678+
if is_op_runnable() and (not is_windows): # special handling of boolean ndarray
679+
y = test_mean(x)
680+
assert y.shape == expected_ret.shape
681+
assert_almost_equal(y.asnumpy(), expected_ret, rtol=1e-3 if dtype == 'float16' else 1e-3,
682+
atol=1e-5 if dtype == 'float16' else 1e-5)
683+
continue
679684

680685
# test imperative
681686
mx_out = np.mean(x, axis=axis, dtype=dtype, keepdims=keepdims)

0 commit comments

Comments
 (0)