Skip to content

Conversation

anijain2305
Copy link
Contributor

@kevinthesun @zhiics @giuseros

TFLite prequantized Resent model was failing to compile. I found that the pad calculation introduce int64 datatype in the shape of max pool2d, that later causes issues with tensorization. Int64 was introduced because of the calculation between python int and np.int32, which results in np.int64. This PR ensures that all the padding calculations happen in python int.

Additionally, I have added a small check to print i64 in AsText. This helped in identifying which op was introducing the int64 datatype.


out = int(math.ceil(float(data) / float(stride)))
pad = max(0, (out - 1) * stride + kernel - data)
pad = max(0, (out - 1) * int(stride) + int(kernel) - int(data))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to somehow test the compilation for skylake/cascadelake target?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do we know why this fails with int64? AFAIU from your RFC: https://discuss.tvm.apache.org/t/int64-vs-int32-dtype-error/8555 this used to work before.

@merrymercy
Copy link
Member

merrymercy commented Dec 4, 2020

I also found the same problem and sent #7030 to fix it. Your modification of AsText is nice.

@masahi masahi closed this Nov 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants