public void SpeedTest()
        {
            int inwidth = 512, inheight = 512, channels = 32, scale = 2;
            int outwidth = inwidth * scale, outheight = inheight * scale;

            OverflowCheckedTensor x_tensor = new OverflowCheckedTensor(Shape.Map2D(channels, inwidth, inheight));
            OverflowCheckedTensor y_tensor = new OverflowCheckedTensor(Shape.Map2D(channels, outwidth, outheight));

            NeighborZoom ope = new NeighborZoom(inwidth, inheight, channels);

            Stopwatch sw = new Stopwatch();

            sw.Start();

            ope.Execute(x_tensor, y_tensor);
            ope.Execute(x_tensor, y_tensor);
            ope.Execute(x_tensor, y_tensor);
            ope.Execute(x_tensor, y_tensor);

            sw.Stop();

            Console.WriteLine($"{sw.ElapsedMilliseconds / 4} msec");
        }
        public void ExecuteTest()
        {
            float max_err = 0;

            int scale = 2;

            foreach (int batch in new int[] { 1, 2 })
            {
                foreach (int channels in new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9 })
                {
                    foreach (int inwidth in new int[] { 5, 7, 11 })
                    {
                        foreach (int inheight in new int[] { 5, 7, 11 })
                        {
                            foreach (int indepth in new int[] { 5, 7, 11 })
                            {
                                int outwidth = inwidth * scale, outheight = inheight * scale, outdepth = indepth * scale;

                                float[] xval = (new float[inwidth * inheight * indepth * channels * batch]).Select((_, idx) => idx * 1e-3f).ToArray();

                                Map3D x = new Map3D(channels, inwidth, inheight, indepth, batch, xval);

                                Map3D y = Reference(x, scale);

                                OverflowCheckedTensor x_tensor = new OverflowCheckedTensor(Shape.Map3D(channels, inwidth, inheight, indepth, batch), xval);
                                OverflowCheckedTensor y_tensor = new OverflowCheckedTensor(Shape.Map3D(channels, outwidth, outheight, outdepth, batch));

                                NeighborZoom ope = new NeighborZoom(inwidth, inheight, indepth, channels, batch);

                                ope.Execute(x_tensor, y_tensor);

                                float[] y_expect = y.ToArray();
                                float[] y_actual = y_tensor.State;

                                CollectionAssert.AreEqual(xval, x_tensor.State);

                                AssertError.Tolerance(y_expect, y_actual, 1e-7f, 1e-5f, ref max_err, $"mismatch value {channels},{inwidth},{inheight},{indepth},{batch}");

                                Console.WriteLine($"pass: {channels},{inwidth},{inheight},{indepth},{batch}");
                            }
                        }
                    }
                }
            }

            Console.WriteLine($"maxerr:{max_err}");
        }