[all-commits] [llvm/llvm-project] 58c8b2: Replacing `is` with `==` for the dtype check.

Prashant Kumar via All-commits all-commits at lists.llvm.org
Thu Dec 1 18:34:47 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 58c8b253cdd5ccd4e61d5854a8a614b35498276f
      https://github.com/llvm/llvm-project/commit/58c8b253cdd5ccd4e61d5854a8a614b35498276f
  Author: Prashant Kumar <prashant at nod-labs.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

  Changed paths:
    M mlir/python/mlir/runtime/np_to_memref.py

  Log Message:
  -----------
  Replacing `is` with `==` for the dtype check.

>>> a = np.ndarray([1,1]).astype(np.half)
>>> a
array([[0.007812]], dtype=float16)
>>> a.dtype
dtype('float16')
>>> a.dtype == np.half
True
>>> a.dtype == np.float16
True
>>> a.dtype is np.float16
False

Checking with `is` leads to inconsistency in checking.

Reviewed By: silvas

Differential Revision: https://reviews.llvm.org/D139121




More information about the All-commits mailing list