(self, subscripts, operands=None)
| 922 | assert res is a |
| 923 | |
| 924 | def optimize_compare(self, subscripts, operands=None): |
| 925 | # Tests all paths of the optimization function against |
| 926 | # conventional einsum |
| 927 | if operands is None: |
| 928 | args = [subscripts] |
| 929 | terms = subscripts.split('->')[0].split(',') |
| 930 | for term in terms: |
| 931 | dims = [global_size_dict[x] for x in term] |
| 932 | args.append(np.random.rand(*dims)) |
| 933 | else: |
| 934 | args = [subscripts] + operands |
| 935 | |
| 936 | noopt = np.einsum(*args, optimize=False) |
| 937 | opt = np.einsum(*args, optimize='greedy') |
| 938 | assert_almost_equal(opt, noopt) |
| 939 | opt = np.einsum(*args, optimize='optimal') |
| 940 | assert_almost_equal(opt, noopt) |
| 941 | |
| 942 | def test_hadamard_like_products(self): |
| 943 | # Hadamard outer products |
no test coverage detected