提交 e64de054 编写于 作者: L liuqi 提交者: wuchenghui

Update to new index typedef for batch_norm related code.

上级 b711b557
......@@ -13,7 +13,7 @@ static void BatchNorm(int iters, int batch, int channels, int height, int width)
std::mt19937 gen(rd());
std::normal_distribution<float> nd(0, 1);
TIndex input_size = batch * channels * height * width;
index_t input_size = batch * channels * height * width;
std::vector<T> input(input_size, 0.0);
std::vector<T> scale(channels, 0.0);
std::vector<T> offset(channels, 0.0);
......@@ -50,7 +50,7 @@ static void BatchNorm(int iters, int batch, int channels, int height, int width)
#define BM_BATCH_NORM_MACRO(N, C, H, W, TYPE, DEVICE) \
static void BM_BATCH_NORM_##N##_##C##_##H##_##W##_##TYPE##_##DEVICE( \
int iters) { \
const int64 tot = static_cast<int64>(iters) * N * C * H * W; \
const int64_t tot = static_cast<int64_t>(iters) * N * C * H * W; \
mace::testing::ItemsProcessed(tot); \
mace::testing::BytesProcessed(tot * (sizeof(TYPE)));\
BatchNorm<DEVICE, TYPE>(iters, N, C, H, W); \
......
......@@ -15,12 +15,12 @@ TEST(BatchNormNeonTest, Simple) {
srand(time(NULL));
// generate random input
TIndex batch = 1 + rand() % 128;
TIndex channels = 3;
TIndex height = 2 + rand() % 100;
TIndex width = 2 + rand() % 100;
index_t batch = 1 + rand() % 128;
index_t channels = 3;
index_t height = 2 + rand() % 100;
index_t width = 2 + rand() % 100;
TIndex input_size = batch * channels * height * width;
index_t input_size = batch * channels * height * width;
std::vector<float> input(input_size, 0.0);
std::vector<float> scale(channels, 0.0);
std::vector<float> offset(channels, 0.0);
......@@ -64,7 +64,7 @@ TEST(BatchNormNeonTest, Simple) {
output_neon.get()
);
for (TIndex i = 0; i < input_size; ++i) {
for (index_t i = 0; i < input_size; ++i) {
EXPECT_FLOAT_EQ(output[i], output_neon[i]);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册