/external/tensorflow/tensorflow/compiler/tests/ |
D | nary_ops_test.py | 23 import numpy as np namespace 58 [np.array([[1, 2, 3]], dtype=np.float32)], 59 expected=np.array([[1, 2, 3]], dtype=np.float32)) 62 [np.array([1, 2], dtype=np.float32), 63 np.array([10, 20], dtype=np.float32)], 64 expected=np.array([11, 22], dtype=np.float32)) 66 [np.array([-4], dtype=np.float32), 67 np.array([10], dtype=np.float32), 68 np.array([42], dtype=np.float32)], 69 expected=np.array([48], dtype=np.float32)) [all …]
|
D | binary_ops_test.py | 23 import numpy as np namespace 60 rtol = 1e-15 if a.dtype == np.float64 else 1e-3 62 atol = 1e-15 if a.dtype == np.float64 else 1e-6 87 np.array([[[[-1, 2.00009999], [-3, b]]]], dtype=dtype), 88 np.array([[[[a, 2], [-3.00009, 4]]]], dtype=dtype), 89 expected=np.array([[[[False, True], [True, False]]]], dtype=dtype)) 93 np.array([3, 3, -1.5, -8, 44], dtype=dtype), 94 np.array([2, -2, 7, -4, 0], dtype=dtype), 95 expected=np.array( 102 np.array([0, np.sqrt(2), 1, np.sqrt(2), 0], dtype), [all …]
|
D | unary_ops_test.py | 23 import numpy as np namespace 42 return np.transpose(x, [0, rank - 1] + list(range(1, rank - 1))) 92 self.assertAllEqual(np.sort(result), result) 101 for dtype in self.numeric_types - {np.int8, np.uint8}: 103 array_ops.diag, np.array([1, 2, 3, 4], dtype=dtype), 104 np.array( 109 np.arange(36).reshape([2, 3, 2, 3]).astype(dtype), 110 np.array([[0, 7, 14], [21, 28, 35]], dtype=dtype)) 112 array_ops.diag, np.array([[1, 2], [3, 4]], dtype=dtype), 113 np.array( [all …]
|
D | complex_div_test.py | 23 import numpy as np namespace 54 np.array([ 56 complex(1, np.inf), 57 complex(1, np.nan), 58 complex(np.inf, 1), 59 complex(np.inf, np.inf), 60 complex(np.inf, np.nan), 61 complex(np.nan, 1), 62 complex(np.nan, np.inf), 63 complex(np.nan, np.nan), [all …]
|
D | ternary_ops_test.py | 22 import numpy as np namespace 54 expected = np.linspace(start, end, num, dtype=np.float32) 57 np.float32(start), 58 np.float32(end), 59 np.int32(num), 69 np.int32(1), 70 np.int32(2), 71 np.int32(1), 72 expected=np.array([1], dtype=np.int32)) 75 np.int32(1), [all …]
|
D | gather_nd_op_test.py | 21 import numpy as np namespace 44 np.array([7, 7, 8], dtype=dtype), 46 np.array([8, 1, 2, 3, 7, 5], dtype=dtype), 47 np.array([[4], [4], [0]], np.int32))) 52 params = np.ones((3, 3), dtype=np.float32) 54 indices_empty = np.empty((0, 2), dtype=np.int32) 56 self.assertAllClose(np.empty((0,), dtype=np.float32), gather_nd_ok_val) 58 indices_empty = np.empty((0, 1), dtype=np.int32) 60 self.assertAllClose(np.empty((0, 3), dtype=np.float32), gather_nd_ok_val) 62 params_empty = np.empty((0, 3), dtype=np.float32) [all …]
|
D | dynamic_stitch_test.py | 21 import numpy as np namespace 53 idx1 = np.array([0, 2], dtype=np.int32) 54 idx2 = np.array([[1], [3]], dtype=np.int32) 55 val1 = np.array([[], []], dtype=np.int32) 56 val2 = np.array([[[]], [[]]], dtype=np.int32) 59 expected=np.array([[], [], [], []], np.int32)) 62 idx1 = np.array([], dtype=np.int32) 63 idx2 = np.array([[], []], dtype=np.int32) 64 val1 = np.ndarray(shape=(0, 9), dtype=np.int32) 65 val2 = np.ndarray(shape=(2, 0, 9), dtype=np.int32) [all …]
|
D | reduce_ops_test.py | 25 import numpy as np namespace 79 np.zeros(shape=(2, 0)), 80 np.zeros(shape=(0, 30)), 81 np.arange(1, 7).reshape(2, 3), 82 np.arange(-10, -4).reshape(2, 3), 83 np.arange(-4, 2).reshape(2, 3), 86 np.zeros(shape=(2, 0)).astype(np.complex64), 87 np.zeros(shape=(0, 30)).astype(np.complex64), 88 np.arange(1, 13, dtype=np.float32).view(np.complex64).reshape(2, 3), 89 np.arange(-14, -2, dtype=np.float32).view(np.complex64).reshape(2, 3), [all …]
|
D | scatter_nd_op_test.py | 23 import numpy as np namespace 33 return v.astype(vtype) if isinstance(v, np.ndarray) else vtype(v) 68 ref = np.zeros(shape, dtype=updates.dtype) 80 np.random.seed(8) 92 for coord, _ in np.ndenumerate(np.empty(indexable_area_shape, vtype)) 94 np.random.shuffle(all_indices) 95 indices = np.array(all_indices[:num_updates]) 100 indices = np.append( 101 indices, [indices[np.random.randint(num_updates // 2)]], axis=0) 102 np.random.shuffle(indices) [all …]
|
D | xla_ops_test.py | 24 import numpy as np namespace 61 args=(np.array([1, 2, 3], dtype=dtype), 62 np.array([4, 5, 6], dtype=dtype)), 63 expected=np.array([5, 7, 9], dtype=dtype)) 67 args=(np.array([[1, 2], [3, 4]], dtype=dtype), 68 np.array([7, 11], dtype=dtype)), 69 expected=np.array([[8, 9], [14, 15]], dtype=dtype)) 73 args=(np.array([[1, 2], [3, 4]], dtype=dtype), 74 np.array([7, 11], dtype=dtype)), 75 expected=np.array([[8, 13], [10, 15]], dtype=dtype)) [all …]
|
/external/tensorflow/tensorflow/python/lib/core/ |
D | bfloat16_test.py | 29 import numpy as np namespace 40 a = a.astype(np.float32) if a.dtype == bfloat16 else a 41 b = b.astype(np.float32) if b.dtype == bfloat16 else b 42 return np.testing.assert_allclose(a, b, **kwargs) 62 np.testing.assert_equal(v, float(bfloat16(v))) 65 for dtype in [np.float16, np.float32, np.float64]: 66 np.testing.assert_equal(-3.75, dtype(bfloat16(dtype(-3.75)))) 67 np.testing.assert_equal(1.5, float(bfloat16(dtype(1.5)))) 68 np.testing.assert_equal(4.5, dtype(bfloat16(np.array(4.5, dtype)))) 69 np.testing.assert_equal( [all …]
|
/external/tensorflow/tensorflow/python/kernel_tests/boosted_trees/ |
D | training_ops_test.py | 20 import numpy as np namespace 50 feature1_nodes = np.array([0], dtype=np.int32) 51 feature1_gains = np.array([7.62], dtype=np.float32) 52 feature1_thresholds = np.array([52], dtype=np.int32) 53 feature1_left_node_contribs = np.array([[-4.375]], dtype=np.float32) 54 feature1_right_node_contribs = np.array([[7.143]], dtype=np.float32) 56 feature2_nodes = np.array([0], dtype=np.int32) 57 feature2_gains = np.array([0.63], dtype=np.float32) 58 feature2_thresholds = np.array([23], dtype=np.int32) 59 feature2_left_node_contribs = np.array([[-0.6]], dtype=np.float32) [all …]
|
/external/tensorflow/tensorflow/python/keras/layers/ |
D | dense_attention_test.py | 22 import numpy as np namespace 42 scores = np.array([[[1.1]]], dtype=np.float32) 44 v = np.array([[[1.6]]], dtype=np.float32) 46 scores_mask = np.array([[[True]]], dtype=np.bool_) 51 expected_scores = np.array([[[1.]]], dtype=np.float32) 55 expected = np.array([[[1.6]]], dtype=np.float32) 60 scores = np.array([[[1.1]]], dtype=np.float32) 62 v = np.array([[[1.6]]], dtype=np.float32) 67 expected_scores = np.array([[[1.]]], dtype=np.float32) 71 expected = np.array([[[1.6]]], dtype=np.float32) [all …]
|
/external/tensorflow/tensorflow/python/kernel_tests/ |
D | cwise_ops_unary_test.py | 23 import numpy as np namespace 46 def _sparsify(x, thresh=0.5, index_dtype=np.int64): 49 non_zero = np.where(x) 50 x_indices = np.vstack(non_zero).astype(index_dtype).T 66 if dtype == np.float16: 68 elif dtype in (np.float32, np.complex64): 70 elif dtype in (np.float64, np.complex128): 89 if x.dtype == np.float16: 96 if x.dtype in (np.complex64, np.complex128) and tf_func == math_ops.sign: 99 if x.dtype in (np.float16, dtypes_lib.bfloat16.as_numpy_dtype): [all …]
|
D | cast_op_test.py | 21 import numpy as np namespace 38 if dtype == np.float32: 40 elif dtype == np.float64: 42 elif dtype == np.int32: 44 elif dtype == np.int64: 46 elif dtype == np.bool: 48 elif dtype == np.complex64: 50 elif dtype == np.complex128: 57 val = constant_op.constant(x, self._toDataType(np.array([x]).dtype)) 71 np.float32, np.float64, np.int64, np.complex64, np.complex128 [all …]
|
D | cwise_ops_binary_test.py | 21 import numpy as np namespace 49 def _sparsify(x, thresh=0.5, index_dtype=np.int64): 52 non_zero = np.where(x) 53 x_indices = np.vstack(non_zero).astype(index_dtype).T 67 if dtype == np.float16: 69 elif dtype in (np.float32, np.complex64): 71 elif dtype in (np.float64, np.complex128): 99 if np_ans.dtype != np.object: 127 if x.dtype in (np.float32, np.float64): 157 if x.dtype in (np.float32, np.float64): [all …]
|
D | relu_op_test.py | 21 import numpy as np namespace 40 return np.exp(activation) 47 return np.maximum(np_features, np.zeros(np_features.shape)) 51 np.array([[0.0, 0.7, 0.0, 0.3, 0.0], [0.1, 0.0, 0.5, 0.0, 0.9]]), 53 np.array([[-0.9, 0.7, -0.5, 0.3, -0.1], [0.1, -0.3, 0.5, -0.7, 63 for t in [np.int32, np.int64, np.float16, np.float32, np.float64]: 67 np.array([[-9, 7, -5, 3, -1], [1, -3, 5, -7, 9]]).astype(t)) 72 for t in [np.float16, np.float32, np.float64]: 74 np.array([[-9, 7, -5, 3, -1], [1, -3, 5, -7, 9]]).astype(t)) 79 inputs = np.array([[-50, 7, 23, 0], [-1, -5, 6, 11]]) [all …]
|
D | parse_single_example_op_test.py | 23 import numpy as np namespace 53 return (np.empty(shape=(0, len(shape)), dtype=np.int64), 54 np.array([], dtype=dtype), np.array(shape, dtype=np.int64)) 132 b_default = np.random.rand(3, 3).astype(bytes) 133 c_default = np.random.rand(2).astype(np.float32) 136 np.empty((0, 1), dtype=np.int64), # indices 137 np.empty((0,), dtype=np.int64), # sp_a is DT_INT64 138 np.array([0], dtype=np.int64)) # max_elems = 0 142 a_name: np.array([a_default]), 143 b_name: np.array(b_default), [all …]
|
D | cwise_ops_test.py | 21 import numpy as np namespace 56 def _sparsify(x, thresh=0.5, index_dtype=np.int64): 59 non_zero = np.where(x) 60 x_indices = np.vstack(non_zero).astype(index_dtype).T 74 if dtype == np.float16: 76 elif dtype in (np.float32, np.complex64): 78 elif dtype in (np.float64, np.complex128): 89 ops.convert_to_tensor(np.array([x]).astype(dtype)), 90 ops.convert_to_tensor(np.array([y]).astype(dtype))) 95 dtypes = [np.float16, np.float32, np.float64, np.int32, np.int64] [all …]
|
D | transpose_op_test.py | 23 import numpy as np namespace 38 ret = np.copy(x) 45 perm = (rank - 1) - np.arange(rank) 50 np_ans = np.conj(np_ans) 60 xs = list(np.shape(x)) 61 ys = list(np.shape(tf_ans)) 62 if x.dtype in [np.float32, np.complex64]: 66 elif x.dtype in [np.float64, np.complex128]: 76 perm = (rank - 1) - np.arange(rank) 81 np_ans = np.conj(np_ans) [all …]
|
D | bincount_op_test.py | 21 import numpy as np namespace 49 bincount_ops.bincount([], minlength=0, dtype=np.float32)).dtype, 50 np.float32) 53 bincount_ops.bincount([], minlength=3, dtype=np.float64)).dtype, 54 np.float64) 73 self.evaluate(bincount_ops.bincount(np.arange(10000))), 74 np.ones(10000)) 88 np.random.seed(42) 90 arr = np.random.randint(0, 1000, num_samples) 92 weights = np.random.randint(-100, 100, num_samples) [all …]
|
/external/tensorflow/tensorflow/python/ops/ |
D | bincount_ops_test.py | 22 import numpy as np namespace 42 "x": np.array([[3, 2, 1], [5, 4, 4]], dtype=np.int32), 48 "x": np.array([[3, 2, 1, 7], [7, 0, 4, 4]], dtype=np.int32), 55 "x": np.array([[3, 2, 1, 7], [7, 0, 4, 4]], dtype=np.int32), 63 "x": np.array([[3, 2, 1, 7], [7, 0, 4, 4]], dtype=np.int32), 71 "x": np.array([[3, 2, 1], [5, 4, 4]], dtype=np.int32), 78 "x": np.array([[3, 2, 1, 7], [7, 0, 4, 4]], dtype=np.int32), 86 "x": np.array([[3, 2, 1, 7], [7, 0, 4, 4]], dtype=np.int32), 95 "x": np.array([[3, 2, 1, 7], [7, 0, 4, 4]], dtype=np.int32), 104 "x": np.array([[3, 2, 1], [5, 4, 4]], dtype=np.int32), [all …]
|
/external/python/pybind11/tests/ |
D | test_numpy_vectorize.py | 5 np = pytest.importorskip("numpy") variable 9 assert np.isclose(m.vectorized_func3(np.array(3 + 7j)), [6 + 14j]) 13 assert np.isclose(f(1, 2, 3), 6) 16 assert np.isclose(f(np.array(1), np.array(2), 3), 6) 19 assert np.allclose(f(np.array([1, 3]), np.array([2, 4]), 3), [6, 36]) 28 a = np.array([[1, 2], [3, 4]], order="F") 29 b = np.array([[10, 20], [30, 40]], order="F") 32 assert np.allclose(result, a * b * c) 46 np.array([[1, 3, 5], [7, 9, 11]]), 47 np.array([[2, 4, 6], [8, 10, 12]]), [all …]
|
/external/tensorflow/tensorflow/python/data/kernel_tests/ |
D | from_tensor_slices_test.py | 23 import numpy as np namespace 42 np.tile(np.array([[1], [2], [3], [4]]), 20), np.tile( 43 np.array([[12], [13], [14], [15]]), 22), 44 np.array([37.0, 38.0, 39.0, 40.0]) 91 indices=np.array([[0, 0], [1, 0], [2, 0]]), 92 values=np.array([0, 0, 0]), 93 dense_shape=np.array([3, 1])), 95 indices=np.array([[0, 0], [1, 1], [2, 2]]), 96 values=np.array([1, 2, 3]), 97 dense_shape=np.array([3, 3]))) [all …]
|
/external/tensorflow/tensorflow/python/ops/numpy_ops/ |
D | np_arrays_test.py | 21 import numpy as np namespace 38 self.assertIs(a.dtype.as_numpy_dtype, np.int64) 43 a = ops.convert_to_tensor(value=1.1, dtype=dtypes.float32).astype(np.int32) 44 self.assertIs(a.dtype.as_numpy_dtype, np.int32) 47 np.bool_) 48 self.assertIs(a.dtype.as_numpy_dtype, np.bool_) 56 a = ops.convert_to_tensor(value=a, dtype=np.int32) 57 b = ops.convert_to_tensor(value=b, dtype=np.int32) 59 out = ops.convert_to_tensor(value=out, dtype=np.int32) 61 types = [[np.int32, np.int32, np.int32], [np.int64, np.int32, np.int64], [all …]
|