vit-tensorflow icon indicating copy to clipboard operation
vit-tensorflow copied to clipboard

Mobile ViT

Open conceptofmind opened this issue 3 years ago • 1 comments
trafficstars

Hi @taki0112 ,

When running the Mobile ViT python file I receive an error.

v = MobileViT(
        image_size=(256, 256),
        dims=[96, 120, 144],
        channels=[16, 32, 48, 48, 64, 64, 80, 80, 96, 96, 384],
        num_classes=1000
    )

    img = tf.random.normal(shape=[1, 256, 256, 3])
    preds = v(img)  # (1, 1000)

Error:

dots = tf.matmul(q, tf.transpose(k, perm=[0, 1, 3, 2])) * self.scale
tensorflow.python.framework.errors_impl.InvalidArgumentError: Exception encountered when calling layer "attention" (type Attention).

transpose expects a vector of size 5. But input(1) is a vector of size 4 [Op:Transpose]

Call arguments received by layer "attention" (type Attention):
  • x=tf.Tensor(shape=(1, 4, 256, 96), dtype=float32)
  • training=True

Thank you,

Enrico

conceptofmind avatar Jun 08 '22 02:06 conceptofmind

Me too, anyone made it working?

svobora avatar May 02 '23 06:05 svobora