Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Error in operator global_pool: [19:16:46] g:\deeplearn\mxnet\src\operator\./pooling-inl.h:196: Check failed: param_.kernel[0] <= dshape[2] + 2 * param_.pad[0] kernel size (7) exceeds input (2 padded to 2) #6882

Closed
paulfryer opened this issue Jun 30, 2017 · 1 comment

Comments

@paulfryer
Copy link

Any ideas what might cause that error? Intuition about what sort of things I should focus on? I'm getting this error when calling model.Predict

Environment info

Operating System: Windows
Compiler: Visual Studio
Package used (Python/R/Scala/Julia): C#

Error Message:

Error in operator global_pool: [19:16:46] g:\deeplearn\mxnet\src\operator./pooling-inl.h:196: Check failed: param_.kernel[0] <= dshape[2] + 2 * param_.pad[0] kernel size (7) exceeds input (2 padded to 2)

at mxnet.csharp.Util.CallCheck(Int32 ret) in F:\Projects\mxnet.csharp\mxnet.csharp\Util.cs:line 81
at mxnet.csharp.Symbol.InferShape(Dictionary2 argShapes, List1 inShape, List1 outShape, List1 auxShape) in F:\Projects\mxnet.csharp\mxnet.csharp\Symbol.cs:line 415
at mxnet.csharp.Symbol.SimpleBind(Context context, Dictionary2 inputShapes, OpReqType gradReq, Dictionary2 typeDict, Dictionary2 group2Ctx) in F:\Projects\mxnet.csharp\mxnet.csharp\Symbol.cs:line 575 at mxnet.csharp.FeedForward.InitPredictor(Dictionary2 inputShapes) in F:\Projects\mxnet.csharp\mxnet.csharp\FeedForward_Predict.cs:line 107
at mxnet.csharp.FeedForward.Predict(IDataIter inputX, Nullable`1 numBatch, Boolean returnData, Boolean reset) in F:\Projects\mxnet.csharp\mxnet.csharp\FeedForward_Predict.cs:line 23
at test.console.Program.TrainTest(String path) in F:\Projects\mxnet.csharp\test.console\Program.cs:line 163
at test.console.Program.Main(String[] args) in F:\Projects\mxnet.csharp\test.console\Program.cs:line 82

What have you tried to solve it?

  1. Tried changing batch size

Minimum reproducible example

        int batch_size = 1;
        uint size ;
        IntPtr array = new IntPtr();
        IntPtr strARray ;
        NativeMethods.MXListAllOpNames(out size, out strARray);
        var pnet = Symbol.Load("Inception-BN-symbol.json");
        Context ctx = new Context(DeviceType.KCpu, 0);
        Speedometer speed = new Speedometer(batch_size, 50);
        DoCheckpoint doCheckpoint = new DoCheckpoint(path);

        CustomMetric customMetric = new CustomMetric((l, p) => Accuracy(l, p, batch_size), "Accuracy");

        Optimizer optimizer = new CcSgd(momentum: 0.9f, learningRate: 0.001f, wd: 0.00001f, rescaleGrad: 1.0f / batch_size);

        FeedForward model = null;
        try
        {
            var modelload = FeedForward.Load(path, ctx: ctx,
                numEpoch: 1,
                optimizer: optimizer,
                initializer: new Xavier(factorType: FactorType.In, magnitude: 2.34f));

             model = new FeedForward(pnet, new List<Context> { ctx },
                numEpoch: 1,
                optimizer: optimizer,
                initializer: new Xavier(factorType: FactorType.In, magnitude: 2.34f),
                argParams: modelload.ArgParams,
                auxParams: modelload.AuxParams
            );

        }
        catch (Exception)
        {
            // ignored
        }

        if (model == null)
        {
            model = new FeedForward(pnet, new List<Context> { ctx },
                numEpoch: 1,
                optimizer: optimizer,
                initializer: new Xavier(factorType: FactorType.In, magnitude: 2.34f)
            );
        }
        ReadData rdpredict = new ReadData("images\\", batch_size, true); //, true);
        var testOut = model.Predict(rdpredict, batch_size);
@szha
Copy link
Member

szha commented Sep 30, 2017

This issue is closed due to lack of activity in the last 90 days. Feel free to ping me to reopen if this is still an active issue. Thanks!

@szha szha closed this as completed Sep 30, 2017
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants