Skip to content

'mlx.core.matmul/tensordot' do not support integer type matrix operations #516

Description

@Redempt1onzzZZ

Describe the bug
I found that mlx.core.matmul/tensordot do not support integer type matrix operations, but numpy does, and it is not stated in the mlx documentation that these two APIs do not support integer type operations

To Reproduce

Include code snippet

import mlx.core as mx
import numpy as np

a1 = np.array([[1, 2], [3, 4]])
b1 = np.array([[5, 6], [7, 8]])
npresult = np.tensordot(a1, b1)
print('numpy', npresult)

a = mx.array([[1, 2], [3, 4]])
b = mx.array([[5, 6], [7, 8]])
mlxresult = mx.tensordot(a, b)
print('mlx', mlxresult)

image

import mlx.core as mx
import numpy as np

a1 = np.array([[1, 2], [3, 4]])
b1 = np.array([[5, 6], [7, 8]])
npresult = np.matmul(a1, b1)
print('numpy', npresult)

a = mx.array([[1, 2], [3, 4]])
b = mx.array([[5, 6], [7, 8]])
mlxresult = mx.matmul(a, b)
print('mlx', mlxresult)

image

Desktop (please complete the following information):

  • OS Version: MacOS 14.2.1
  • Version 0.10.0
  • numpy 1.26.2

Additional context
According to my inspection, only these two APIs were found to have this issue. I am not sure if there are other APIs that also have this issue. If it is the design of mlx itself, I think it can be explained in the documentation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions