5 #include "smaug/operators/smv/smv_test_common.h"
9 constexpr
float kMean = 0.0;
10 constexpr
float kVar = 0.1;
11 std::default_random_engine generator;
12 std::normal_distribution<float> normalDist(kMean, kVar);
13 constexpr
float kFraction = 0.1;
17 float16* dataPtr = tensor->
data<float16>();
18 for (
int i = 0; i < tensor->getShape().storageSize(); i++)
19 dataPtr[i] =
fp16(normalDist(generator));
25 float16* dataPtr = tensor->
data<float16>();
28 for (
int i = 0; i < shape.storageSize(); i++) {
29 dataPtr[i] =
fp16((value++) * kFraction);
30 if ((i + 1) % resetCounter == 0)
37 float16* dataPtr = tensor->
data<float16>();
38 int expectedValue = valueOffset;
39 int resetCounter = tensor->getShape().
getStorageDim(shape.ndims() - 1);
40 int totalSize = tensor->getShape().storageSize();
41 for (
int i = 0; i < totalSize; i++) {
43 expectedValue * kFraction);
45 if ((i + 1) % resetCounter == 0)
46 expectedValue = valueOffset;