@staticmethod
    def _contract_ndarray(free1, free2, ndarray1, ndarray2):
        numpy = import_module('numpy')

        def ikey(x):
            # sort by component number , then by position in component
            return x[2], x[1]

        free1 = free1[:]
        free2 = free2[:]
        free1.sort(key=ikey)
        free2.sort(key=ikey)
        self_free = [_[0] for _ in free1]
        axes1 = []
        axes2 = []
        for jpos, jindex in enumerate(free2):
            if self_free in -jindex[0]:
                nidx = self_free.index(-jindex[0])
            else:
                continue
            axes1.append(nidx)
            axes2.append(jpos)

        contracted_ndarray = numpy.tensordot(
            ndarray1,
            ndarray2,
            (axes1, axes2)
        )
        return contracted_ndarray
dataset/ETHPy150Open sympy/sympy/sympy/tensor/tensor.py/_TensorDataLazyEvaluator._contract_ndarray/swapped operands of `in`