Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Barracuda 0.6.1] Cannot Reshape Array of size ... into shape with multiple of ... elements

Discussion in 'Barracuda' started by san22, May 7, 2020.

  1. san22

    san22

    Joined:
    Aug 23, 2018
    Posts:
    1
    Hi,
    I have converted a pytorch(1.5.0) pth model to onnx.
    When I put the output model into asset folder, I got this error.

    ArgumentException: Cannot reshape array of size 37632 into shape with multiple of 1024 elements
    Barracuda.TensorExtensions.Reshape (Barracuda.TensorShape shape, System.Int32[] size) (at Library/PackageCache/com.unity.barracuda@0.6.1-preview/Barracuda/Core/TensorExtensions.cs:310)

    Model : Yolact Resnet50
    Onnx Version : 9
    Batch size : 1
    Input Shape(1,550,550,3)
    When I got this error, The Reshaping size : (256,1,4,-1)

    I saw a forum page dealing with simillar issues, the comment was to make batch size larger than sequence length. But in my case, input batch is 1(realtime image).

    So have anyone encountered simillar case like me? Or solve it?
     
    alphapibeta likes this.
  2. alphapibeta

    alphapibeta

    Joined:
    May 29, 2020
    Posts:
    1
    Hey San22, can you share the steps how did you convert Yolact Resnet50 to onnx?
     
  3. alexandreribard_unity

    alexandreribard_unity

    Unity Technologies

    Joined:
    Sep 18, 2019
    Posts:
    53
    Could you share the model in question? I believe that issue has been fixed in 1.3.0
     
  4. lftobar14

    lftobar14

    Joined:
    Sep 30, 2021
    Posts:
    1
    Hi San22, were you able to solve the problem?
     
  5. alexandreribard_unity

    alexandreribard_unity

    Unity Technologies

    Joined:
    Sep 18, 2019
    Posts:
    53
    @lftobar14 if you are getting a similar issue, can you try on latest Barracuda version?
    If it still doesn't work, could you share with us the problematic model?
    Thanks!
     
  6. nehalbaid10

    nehalbaid10

    Joined:
    Aug 5, 2022
    Posts:
    1
    Cannot reshape array of size 4145280 into shape with multiple of 41472 elements
    Unity.Barracuda.TensorExtensions.Reshape

    I am dealing with the same issue, I'm using Unity 2021.3
    Baraccuda - 3.00

    How do i fix it ?

    My onnx model is actually a tensorflow - keras image classification model