From c8f9072ab635e008ba88f4ad62478f8ac3379449 Mon Sep 17 00:00:00 2001 From: Andrey Malevich Date: Tue, 12 Mar 2019 22:57:44 -0700 Subject: [PATCH] Fix half-float conversion ops to handle tensors larger than 2B of params (#17952) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17952 As desc. Reviewed By: hyuen Differential Revision: D14435092 fbshipit-source-id: dc614ba16ad531101d04d01aec8f1fbd534ebec5 --- caffe2/operators/half_float_ops.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/caffe2/operators/half_float_ops.cc b/caffe2/operators/half_float_ops.cc index 3745121..b186ec6 100644 --- a/caffe2/operators/half_float_ops.cc +++ b/caffe2/operators/half_float_ops.cc @@ -12,7 +12,7 @@ bool FloatToHalfOp::RunOnDevice() { at::Half* out = output->template mutable_data(); auto N = input.numel(); - for (auto i = 0; i < N; i++) { + for (size_t i = 0; i < N; i++) { out[i] = data[i]; } @@ -28,7 +28,7 @@ bool HalfToFloatOp::RunOnDevice() { float* out = output->template mutable_data(); auto N = input.numel(); - for (auto i = 0; i < N; i++) { + for (size_t i = 0; i < N; i++) { out[i] = data[i]; } return true; -- 2.7.4