|
6 | 6 | __impl_str = getenv("DDPNP_ARRAY", 'numpy') |
7 | 7 | exec(f"import {__impl_str} as __impl") |
8 | 8 |
|
9 | | -ew_binary_ops = [ |
10 | | - "add", # (x1, x2, /) |
11 | | - "atan2", # (x1, x2, /) |
12 | | - "bitwise_and", # (x1, x2, /) |
13 | | - "bitwise_left_shift", # (x1, x2, /) |
14 | | - "bitwise_or", # (x1, x2, /) |
15 | | - "bitwise_right_shift", # (x1, x2, /) |
16 | | - "bitwise_xor", # (x1, x2, /) |
17 | | - "divide", # (x1, x2, /) |
18 | | - "equal", # (x1, x2, /) |
19 | | - "floor_divide", # (x1, x2, /) |
20 | | - "greater", # (x1, x2, /) |
21 | | - "greater_equal", # (x1, x2, /) |
22 | | - "less_equal", # (x1, x2, /) |
23 | | - "logaddexp", # (x1, x2) |
24 | | - "logical_and", # (x1, x2, /) |
25 | | - "logical_or", # (x1, x2, /) |
26 | | - "logical_xor", # (x1, x2, /) |
27 | | - "multiply", # (x1, x2, /) |
28 | | - "less", # (x1, x2, /) |
29 | | - "not_equal", # (x1, x2, /) |
30 | | - "pow", # (x1, x2, /) |
31 | | - "remainder", # (x1, x2, /) |
32 | | - "subtract", # (x1, x2, /) |
33 | | -] |
34 | | - |
35 | | -for op in ew_binary_ops: |
| 9 | +for op in api.ew_binary_ops: |
36 | 10 | exec( |
37 | 11 | f"{op} = lambda this, other: dtensor(_cdt.ew_binary_op(this._t, '{op}', other._t if isinstance(other, ddptensor) else other, False))" |
38 | 12 | ) |
39 | 13 |
|
40 | | -ew_unary_ops = [ |
41 | | - "abs", # (x, /) |
42 | | - "acos", # (x, /) |
43 | | - "acosh", # (x, /) |
44 | | - "asin", # (x, /) |
45 | | - "asinh", # (x, /) |
46 | | - "atan", # (x, /) |
47 | | - "atanh", # (x, /) |
48 | | - "bitwise_invert", # (x, /) |
49 | | - "ceil", # (x, /) |
50 | | - "cos", # (x, /) |
51 | | - "cosh", # (x, /) |
52 | | - "exp", # (x, /) |
53 | | - "expm1", # (x, /) |
54 | | - "floor", # (x, /) |
55 | | - "isfinite", # (x, /) |
56 | | - "isinf", # (x, /) |
57 | | - "isnan", # (x, /) |
58 | | - "logical_not", # (x, /) |
59 | | - "log", # (x, /) |
60 | | - "log1p", # (x, /) |
61 | | - "log2", # (x, /) |
62 | | - "log10", # (x, /) |
63 | | - "negative", # (x, /) |
64 | | - "positive", # (x, /) |
65 | | - "round", # (x, /) |
66 | | - "sign", # (x, /) |
67 | | - "sin", # (x, /) |
68 | | - "sinh", # (x, /) |
69 | | - "square", # (x, /) |
70 | | - "sqrt", # (x, /) |
71 | | - "tan", # (x, /) |
72 | | - "tanh", # (x, /) |
73 | | - "trunc", # (x, /) |
74 | | -] |
75 | | - |
76 | | -for op in ew_unary_ops: |
| 14 | +for op in api.ew_unary_ops: |
77 | 15 | exec( |
78 | 16 | f"{op} = lambda this: dtensor(_cdt.ew_unary_op(this._t, '{op}', False))" |
79 | 17 | ) |
|
0 commit comments