Reorder if-else statements to allow using of cpu branches for sycl-devices (#9682)
This commit is contained in:
committed by
GitHub
parent
4c0e4422d0
commit
ea9f09716b
@@ -603,13 +603,13 @@ auto MakeTensorView(Context const *ctx, Order order, common::Span<T> data, S &&.
|
||||
|
||||
template <typename T, typename... S>
|
||||
auto MakeTensorView(Context const *ctx, HostDeviceVector<T> *data, S &&...shape) {
|
||||
auto span = ctx->IsCPU() ? data->HostSpan() : data->DeviceSpan();
|
||||
auto span = ctx->IsCUDA() ? data->DeviceSpan() : data->HostSpan();
|
||||
return MakeTensorView(ctx->Device(), span, std::forward<S>(shape)...);
|
||||
}
|
||||
|
||||
template <typename T, typename... S>
|
||||
auto MakeTensorView(Context const *ctx, HostDeviceVector<T> const *data, S &&...shape) {
|
||||
auto span = ctx->IsCPU() ? data->ConstHostSpan() : data->ConstDeviceSpan();
|
||||
auto span = ctx->IsCUDA() ? data->ConstDeviceSpan() : data->ConstHostSpan();
|
||||
return MakeTensorView(ctx->Device(), span, std::forward<S>(shape)...);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user