You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
In embed layer backward function, when grad_out.shape_[0] >grad_out.shape_[1], then it will invoke SortByKey function, which is defined when cuda_version >7000. So , under version 6.5, it will not work, just raise error and abort!
How to make it work under version 6.5? I modify the code, just use
AddTakeGrad(grad_in, data, grad_out);
when backward, but i found the result is worse than in another machine with cuda 7.0.
So How to modify the code to make it work when under cuda version 6.5 and grad_out.shape_[0] > grad_out.shape_[1] ?
This code base has been donated to the Apache MXNet project per #373, and repo is deprecated. Future development and issue tracking should continue in Apache MXNet.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
In embed layer backward function, when grad_out.shape_[0] >grad_out.shape_[1], then it will invoke SortByKey function, which is defined when cuda_version >7000. So , under version 6.5, it will not work, just raise error and abort!
How to make it work under version 6.5? I modify the code, just use
AddTakeGrad(grad_in, data, grad_out);
when backward, but i found the result is worse than in another machine with cuda 7.0.
So How to modify the code to make it work when under cuda version 6.5 and grad_out.shape_[0] > grad_out.shape_[1] ?
The code are as follow:
}
template<typename KDType, typename VDType>
inline void SortByKey(Tensor<gpu, 1, KDType> keys, Tensor<gpu, 1, VDType> values,
bool is_ascend) {
CHECK_EQ(keys.CheckContiguous(), true);
CHECK_EQ(values.CheckContiguous(), true);
if CUDA_VERSION >= 7000
cudaStream_t stream = Stream::GetStream(keys.stream_);
thrust::device_ptr key_iter = thrust::device_pointer_cast(keys.dptr_);
thrust::device_ptr value_iter = thrust::device_pointer_cast(values.dptr_);
if (is_ascend) {
thrust::stable_sort_by_key(
thrust::cuda::par.on(stream),
key_iter, key_iter + keys.size(0), value_iter, thrust::less());
} else {
thrust::stable_sort_by_key(
thrust::cuda::par.on(stream),
key_iter, key_iter + keys.size(0), value_iter, thrust::greater());
}
else
LOG(FATAL) << "SortByKey is only supported for CUDA version >=7.0!";
endif
}
The text was updated successfully, but these errors were encountered: