1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
|
# Owner(s): ["module: dynamo"]
# this file is autogenerated via gen_ufuncs.py
# do not edit manually!
import numpy as np
from torch._numpy._ufuncs import * # noqa: F403
from torch._numpy.testing import assert_allclose
from torch.testing._internal.common_utils import run_tests, TestCase
class TestBinaryUfuncBasic(TestCase):
def test_add(self):
assert_allclose(np.add(0.5, 0.6), add(0.5, 0.6), atol=1e-7, check_dtype=False)
def test_arctan2(self):
assert_allclose(
np.arctan2(0.5, 0.6), arctan2(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_bitwise_and(self):
assert_allclose(
np.bitwise_and(5, 6), bitwise_and(5, 6), atol=1e-7, check_dtype=False
)
def test_bitwise_or(self):
assert_allclose(
np.bitwise_or(5, 6), bitwise_or(5, 6), atol=1e-7, check_dtype=False
)
def test_bitwise_xor(self):
assert_allclose(
np.bitwise_xor(5, 6), bitwise_xor(5, 6), atol=1e-7, check_dtype=False
)
def test_copysign(self):
assert_allclose(
np.copysign(0.5, 0.6), copysign(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_divide(self):
assert_allclose(
np.divide(0.5, 0.6), divide(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_equal(self):
assert_allclose(
np.equal(0.5, 0.6), equal(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_float_power(self):
assert_allclose(
np.float_power(0.5, 0.6),
float_power(0.5, 0.6),
atol=1e-7,
check_dtype=False,
)
def test_floor_divide(self):
assert_allclose(
np.floor_divide(0.5, 0.6),
floor_divide(0.5, 0.6),
atol=1e-7,
check_dtype=False,
)
def test_fmax(self):
assert_allclose(np.fmax(0.5, 0.6), fmax(0.5, 0.6), atol=1e-7, check_dtype=False)
def test_fmin(self):
assert_allclose(np.fmin(0.5, 0.6), fmin(0.5, 0.6), atol=1e-7, check_dtype=False)
def test_fmod(self):
assert_allclose(np.fmod(0.5, 0.6), fmod(0.5, 0.6), atol=1e-7, check_dtype=False)
def test_gcd(self):
assert_allclose(np.gcd(5, 6), gcd(5, 6), atol=1e-7, check_dtype=False)
def test_greater(self):
assert_allclose(
np.greater(0.5, 0.6), greater(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_greater_equal(self):
assert_allclose(
np.greater_equal(0.5, 0.6),
greater_equal(0.5, 0.6),
atol=1e-7,
check_dtype=False,
)
def test_heaviside(self):
assert_allclose(
np.heaviside(0.5, 0.6), heaviside(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_hypot(self):
assert_allclose(
np.hypot(0.5, 0.6), hypot(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_lcm(self):
assert_allclose(np.lcm(5, 6), lcm(5, 6), atol=1e-7, check_dtype=False)
def test_ldexp(self):
assert_allclose(np.ldexp(0.5, 6), ldexp(0.5, 6), atol=1e-7, check_dtype=False)
def test_left_shift(self):
assert_allclose(
np.left_shift(5, 6), left_shift(5, 6), atol=1e-7, check_dtype=False
)
def test_less(self):
assert_allclose(np.less(0.5, 0.6), less(0.5, 0.6), atol=1e-7, check_dtype=False)
def test_less_equal(self):
assert_allclose(
np.less_equal(0.5, 0.6), less_equal(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_logaddexp(self):
assert_allclose(
np.logaddexp(0.5, 0.6), logaddexp(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_logaddexp2(self):
assert_allclose(
np.logaddexp2(0.5, 0.6), logaddexp2(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_logical_and(self):
assert_allclose(
np.logical_and(0.5, 0.6),
logical_and(0.5, 0.6),
atol=1e-7,
check_dtype=False,
)
def test_logical_or(self):
assert_allclose(
np.logical_or(0.5, 0.6), logical_or(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_logical_xor(self):
assert_allclose(
np.logical_xor(0.5, 0.6),
logical_xor(0.5, 0.6),
atol=1e-7,
check_dtype=False,
)
def test_matmul(self):
assert_allclose(
np.matmul([0.5], [0.6]), matmul([0.5], [0.6]), atol=1e-7, check_dtype=False
)
def test_maximum(self):
assert_allclose(
np.maximum(0.5, 0.6), maximum(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_minimum(self):
assert_allclose(
np.minimum(0.5, 0.6), minimum(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_remainder(self):
assert_allclose(
np.remainder(0.5, 0.6), remainder(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_multiply(self):
assert_allclose(
np.multiply(0.5, 0.6), multiply(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_nextafter(self):
assert_allclose(
np.nextafter(0.5, 0.6), nextafter(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_not_equal(self):
assert_allclose(
np.not_equal(0.5, 0.6), not_equal(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_power(self):
assert_allclose(
np.power(0.5, 0.6), power(0.5, 0.6), atol=1e-7, check_dtype=False
)
def test_right_shift(self):
assert_allclose(
np.right_shift(5, 6), right_shift(5, 6), atol=1e-7, check_dtype=False
)
def test_subtract(self):
assert_allclose(
np.subtract(0.5, 0.6), subtract(0.5, 0.6), atol=1e-7, check_dtype=False
)
if __name__ == "__main__":
run_tests()
|