You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/05/17 19:35:46 UTC

[GitHub] [tvm] AndrewZhaoLuo opened a new issue #8058: Type checking sometimes allows negative dimensions in shape

AndrewZhaoLuo opened a new issue #8058:
URL: https://github.com/apache/tvm/issues/8058


   The main example I have is here where avg pool expects an output with negative dimensions in the shape:
   
   ```
   from tvm.relay.testing import densenet
   
   mod, mod_params = densenet.get_workload(classes=5, batch_size=1, image_shape=(1, 224, 224))
   mod_params["data"] = np.random.uniform(-10, 10, (1, 1, 224, 224)).astype("float32")
   
   infer_type_pass = InferType()
   out = infer_type_pass(mod)
   body_typed = out["main"].body
   
   print(body_typed)
   ```
   
   Which produces output including:
   
   `%487 = nn.avg_pool2d(%486, pool_size=[7, 7], padding=[0, 0, 0, 0]) /* ty=Tensor[(1, 1, -5, -5), float32] */;`
   
   *What is expected*:
   
   The type checker will yell at you if it detects nonsensical shapes.
   
   *What can be done*:
   
   This can be done by having the shape relation function for each op check for negative shapes. Alternatively we can determine that negative shapes are inherently nonsensical for every operation and put the check more in the infer type pass.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org