--- /dev/null
+#include <nnkit/Action.h>
+
+#include <nncc/core/ADT/tensor/IndexRange.h>
+
+#include <chrono>
+#include <random>
+
+using nnkit::TensorContext;
+
+struct RandomizeAction final : public nnkit::Action
+{
+ void run(TensorContext &ctx) override
+ {
+ int seed = std::chrono::system_clock::now().time_since_epoch().count();
+
+ std::minstd_rand rand(seed);
+ std::normal_distribution<float> dist(0.0f, 2.0f);
+
+ for (uint32_t n = 0; n < ctx.size(); ++n)
+ {
+ using nncc::core::ADT::tensor::Accessor;
+
+ auto fn = [&dist, &rand] (const TensorContext &ctx, uint32_t n, Accessor<float> &t)
+ {
+ using nncc::core::ADT::tensor::range;
+ using nncc::core::ADT::tensor::Index;
+
+ range(ctx.shape(n)).iterate() << [&t, &dist, &rand] (const Index &i)
+ {
+ t.at(i) = dist(rand);
+ };
+ };
+
+ ctx.getMutableFloatTensor(n, fn);
+ }
+ }
+};
+
+#include <nnkit/CmdlineArguments.h>
+#include <nncc/foundation/Memory.h>
+
+extern "C" std::unique_ptr<nnkit::Action> make_action(const nnkit::CmdlineArguments &args)
+{
+ return nncc::foundation::make_unique<RandomizeAction>();
+}