!7132 fix GPU P.UniformInt bug

Merge pull request !7132 from 34bunny/GPU-fix_UniformInt
pull/7132/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 3a088bfa09

@ -12,7 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
#include "random_op_impl.cuh"
template <typename T>
@ -29,7 +29,7 @@ __global__ void UniformIntKernel(int seed, curandState *globalState, T *input1,
T *input2, size_t input_size_2, T *output, size_t count) {
for (size_t i = blockIdx.x * blockDim.x + threadIdx.x; i < (count); i += blockDim.x * gridDim.x) {
curand_init(seed, i, 0, &globalState[i]);
output[i] = (T)(curand_uniform(&globalState[i])) * (input2[0] - input1[0]) + input1[0];
output[i] = (T)(curand_uniform(&globalState[i]) * (input2[0] - input1[0])) + input1[0];
}
return;
}

Loading…
Cancel
Save