Home
last modified time | relevance | path

Searched refs:np (Results 1 – 25 of 1622) sorted by relevance

12345678910>>...65

/external/tensorflow/tensorflow/compiler/tests/
Dnary_ops_test.py23 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 …]
Dbinary_ops_test.py23 import numpy as np namespace
71 np.array([[[[-1, 2.00009999], [-3, b]]]], dtype=dtype),
72 np.array([[[[a, 2], [-3.00009, 4]]]], dtype=dtype),
73 expected=np.array([[[[False, True], [True, False]]]], dtype=dtype))
77 np.array([3, 3, -1.5, -8, 44], dtype=dtype),
78 np.array([2, -2, 7, -4, 0], dtype=dtype),
79 expected=np.array(
86 np.array([1, 2], dtype=dtype),
87 np.zeros(shape=[0, 2], dtype=dtype),
88 expected=np.zeros(shape=[0, 2], dtype=dtype))
[all …]
Dunary_ops_test.py23 import numpy as np namespace
40 return np.transpose(x, [0, rank - 1] + list(range(1, rank - 1)))
88 for dtype in self.numeric_types - {np.int8, np.uint8}:
90 array_ops.diag, np.array([1, 2, 3, 4], dtype=dtype),
91 np.array(
96 np.arange(36).reshape([2, 3, 2, 3]).astype(dtype),
97 np.array([[0, 7, 14], [21, 28, 35]], dtype=dtype))
99 array_ops.diag, np.array([[1, 2], [3, 4]], dtype=dtype),
100 np.array(
107 np.array([[-1, 1]], dtype=dtype),
[all …]
Dternary_ops_test.py21 import numpy as np namespace
46 np.float32(1),
47 np.float32(2),
48 np.int32(1),
49 expected=np.array([1], dtype=np.float32))
52 np.float32(1),
53 np.float32(4),
54 np.int32(3),
55 expected=np.array([1, 2.5, 4], dtype=np.float32))
60 np.int32(1),
[all …]
Dgather_nd_op_test.py21 import numpy as np namespace
43 np.array([7, 7, 8], dtype=dtype),
45 np.array([8, 1, 2, 3, 7, 5], dtype=dtype),
46 np.array([[4], [4], [0]], np.int32)))
50 params = np.ones((3, 3), dtype=np.float32)
52 indices_empty = np.empty((0, 2), dtype=np.int32)
54 self.assertAllClose(np.empty((0,), dtype=np.float32), gather_nd_ok_val)
56 indices_empty = np.empty((0, 1), dtype=np.int32)
58 self.assertAllClose(np.empty((0, 3), dtype=np.float32), gather_nd_ok_val)
60 params_empty = np.empty((0, 3), dtype=np.float32)
[all …]
Dimage_ops_test.py24 import numpy as np namespace
41 return np.random.randint(0, 256, shape) / 256.
48 np.random.seed(7)
79 rgb_np = np.array(data, dtype=nptype).reshape([2, 2, 3]) / 255.
93 hsv_np = np.array([
95 r.astype(np.float64), g.astype(np.float64), b.astype(np.float64))
122 x_np = np.array(x_data, dtype=np.float32).reshape(x_shape) / 255.
128 y_np = np.array(y_data, dtype=np.float32).reshape(x_shape) / 255.
135 x_np = np.array(x_data, dtype=np.uint8).reshape(x_shape)
138 y_np = np.array(y_data, dtype=np.uint8).reshape(x_shape)
[all …]
Ddynamic_stitch_test.py21 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 …]
Dreduce_ops_test.py24 import numpy as np namespace
74 np.zeros(shape=(2, 0)),
75 np.zeros(shape=(0, 30)),
76 np.arange(1, 7).reshape(2, 3),
77 np.arange(-10, -4).reshape(2, 3),
78 np.arange(-4, 2).reshape(2, 3),
81 np.zeros(shape=(2, 0)).astype(np.complex64),
82 np.zeros(shape=(0, 30)).astype(np.complex64),
83 np.arange(1, 13, dtype=np.float32).view(np.complex64).reshape(2, 3),
84 np.arange(-14, -2, dtype=np.float32).view(np.complex64).reshape(2, 3),
[all …]
/external/tensorflow/tensorflow/python/kernel_tests/boosted_trees/
Dtraining_ops_test.py20 import numpy as np namespace
46 feature1_nodes = np.array([0], dtype=np.int32)
47 feature1_gains = np.array([7.62], dtype=np.float32)
48 feature1_thresholds = np.array([52], dtype=np.int32)
49 feature1_left_node_contribs = np.array([[-4.375]], dtype=np.float32)
50 feature1_right_node_contribs = np.array([[7.143]], dtype=np.float32)
52 feature2_nodes = np.array([0], dtype=np.int32)
53 feature2_gains = np.array([0.63], dtype=np.float32)
54 feature2_thresholds = np.array([23], dtype=np.int32)
55 feature2_left_node_contribs = np.array([[-0.6]], dtype=np.float32)
[all …]
/external/tensorflow/tensorflow/python/keras/layers/
Ddense_attention_test.py21 import numpy as np namespace
34 scores = np.array([[[1.1]]], dtype=np.float32)
36 v = np.array([[[1.6]]], dtype=np.float32)
38 v_mask = np.array([[True]], dtype=np.bool_)
44 expected = np.array([[[1.6]]], dtype=np.float32)
49 scores = np.array([[[1.1]]], dtype=np.float32)
51 v = np.array([[[1.6]]], dtype=np.float32)
57 expected = np.array([[[1.6]]], dtype=np.float32)
62 scores = np.array([[[1., 0., 1.]]], dtype=np.float32)
64 v = np.array([[[1.6], [0.7], [-0.8]]], dtype=np.float32)
[all …]
/external/tensorflow/tensorflow/contrib/learn/python/learn/datasets/
Dsynthetic.py26 import numpy as np namespace
70 np.random.seed(seed)
72 linspace = np.linspace(0, 2 * np.pi, n_samples // n_classes)
73 circ_x = np.empty(0, dtype=np.int32)
74 circ_y = np.empty(0, dtype=np.int32)
75 base_cos = np.cos(linspace)
76 base_sin = np.sin(linspace)
78 y = np.empty(0, dtype=np.int32)
80 circ_x = np.append(circ_x, base_cos)
81 circ_y = np.append(circ_y, base_sin)
[all …]
/external/tensorflow/tensorflow/python/kernel_tests/
Dcast_op_test.py21 import numpy as np namespace
40 if dtype == np.float32:
42 elif dtype == np.float64:
44 elif dtype == np.int32:
46 elif dtype == np.int64:
48 elif dtype == np.bool:
50 elif dtype == np.complex64:
52 elif dtype == np.complex128:
59 val = constant_op.constant(x, self._toDataType(np.array([x]).dtype))
72 np.float32, np.float64, np.int64, np.complex64, np.complex128
[all …]
Dcwise_ops_unary_test.py23 import numpy as np namespace
43 def _sparsify(x, thresh=0.5, index_dtype=np.int64):
46 non_zero = np.where(x)
47 x_indices = np.vstack(non_zero).astype(index_dtype).T
61 if dtype == np.float16:
63 elif dtype in (np.float32, np.complex64):
65 elif dtype in (np.float64, np.complex128):
81 if x.dtype in (np.float32, np.float64,
89 if x.dtype == np.float16:
96 if x.dtype in (np.complex64, np.complex128) and tf_func == math_ops.sign:
[all …]
Dcwise_ops_binary_test.py21 import numpy as np namespace
48 def _sparsify(x, thresh=0.5, index_dtype=np.int64):
51 non_zero = np.where(x)
52 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):
98 if np_ans.dtype != np.object:
126 if x.dtype in (np.float32, np.float64):
156 if x.dtype in (np.float32, np.float64):
[all …]
Dparse_single_example_op_test.py23 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 …]
Dtranspose_op_test.py23 import numpy as np namespace
37 ret = np.copy(x)
44 perm = (rank - 1) - np.arange(rank)
49 np_ans = np.conj(np_ans)
59 xs = list(np.shape(x))
60 ys = list(np.shape(tf_ans))
61 if x.dtype in [np.float32, np.complex64]:
65 elif x.dtype in [np.float64, np.complex128]:
75 perm = (rank - 1) - np.arange(rank)
80 np_ans = np.conj(np_ans)
[all …]
Done_hot_op_test.py21 import numpy as np namespace
56 indices = np.asarray([0, 2, -1, 1], dtype=np.int64)
58 on_value = np.asarray(1.0, dtype=dtype)
59 off_value = np.asarray(-1.0, dtype=dtype)
61 truth = np.asarray(
86 indices = np.asarray([0, 2, -1, 1], dtype=np.int64)
89 truth = np.asarray(
102 self._testBasic(np.float32)
103 self._testDefaultBasic(np.float32)
106 self._testBasic(np.float64)
[all …]
Dcwise_ops_test.py21 import numpy as np namespace
58 def _sparsify(x, thresh=0.5, index_dtype=np.int64):
61 non_zero = np.where(x)
62 x_indices = np.vstack(non_zero).astype(index_dtype).T
76 if dtype == np.float16:
78 elif dtype in (np.float32, np.complex64):
80 elif dtype in (np.float64, np.complex128):
91 ops.convert_to_tensor(np.array([x]).astype(dtype)),
92 ops.convert_to_tensor(np.array([y]).astype(dtype)))
97 dtypes = [np.float16, np.float32, np.float64, np.int32, np.int64]
[all …]
Ddiag_op_test.py20 import numpy as np namespace
38 v = np.array([1.0, 2.0, 3.0])
39 mat = np.diag(v)
46 v_batch = np.array([[1.0, 0.0, 3.0], [4.0, 5.0, 6.0]]).astype(dtype)
47 mat_batch = np.array([[[1.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 3.0]],
56 self._testBatchVector(np.float32)
57 self._testBatchVector(np.float64)
58 self._testBatchVector(np.int32)
59 self._testBatchVector(np.int64)
60 self._testBatchVector(np.bool)
[all …]
/external/tensorflow/tensorflow/contrib/reduce_slice_ops/python/kernel_tests/
Dreduce_slice_ops_test.py21 import numpy as np namespace
31 x = np.array([1, 40, 700], dtype=np.int32)
32 indices = np.array([[0, 1], [0, 3], [1, 2], [1, 3], [0, 2]], dtype=np.int32)
33 result = np.array([1, 741, 40, 740, 41], dtype=np.int32)
39 x = np.array([[1, 2, 3], [40, 50, 60], [700, 800, 900]], dtype=np.int32)
40 indices = np.array([[0, 1], [0, 3], [1, 2], [1, 3], [0, 2]], dtype=np.int32)
41 result = np.array([[1, 2, 3], [741, 852, 963], [40, 50, 60],
42 [740, 850, 960], [41, 52, 63]], dtype=np.int32)
48 x = np.array([[[1, 2], [3, 4]], [[50, 60], [70, 80]],
49 [[600, 700], [800, 900]]], dtype=np.int32)
[all …]
/external/tensorflow/tensorflow/python/data/kernel_tests/
Dinterleave_test.py21 import numpy as np namespace
87 return [[value] * value for value in np.tile(values, count)]
123 ("1", np.int64([4, 5, 6]), 1, 3, None),
124 ("2", np.int64([4, 5, 6]), 1, 3, 1),
125 ("3", np.int64([4, 5, 6]), 2, 1, None),
126 ("4", np.int64([4, 5, 6]), 2, 1, 1),
127 ("5", np.int64([4, 5, 6]), 2, 1, 2),
128 ("6", np.int64([4, 5, 6]), 2, 3, None),
129 ("7", np.int64([4, 5, 6]), 2, 3, 1),
130 ("8", np.int64([4, 5, 6]), 2, 3, 2),
[all …]
Dfrom_tensor_slices_test.py20 import numpy as np namespace
38 np.tile(np.array([[1], [2], [3], [4]]), 20), np.tile(
39 np.array([[12], [13], [14], [15]]), 22),
40 np.array([37.0, 38.0, 39.0, 40.0])
60 indices=np.array([[0, 0], [1, 0], [2, 0]]),
61 values=np.array([0, 0, 0]),
62 dense_shape=np.array([3, 1])),
64 indices=np.array([[0, 0], [1, 1], [2, 2]]),
65 values=np.array([1, 2, 3]),
66 dense_shape=np.array([3, 3])))
[all …]
/external/tensorflow/tensorflow/contrib/distributions/python/kernel_tests/bijectors/
Dsinh_arcsinh_bijector_test.py21 import numpy as np namespace
44 x = np.array([[[-2.01], [2.], [1e-4]]]).astype(np.float32)
45 y = np.sinh((np.arcsinh(x) + skewness) * tailweight)
49 np.sum(
50 np.log(np.cosh(np.arcsinh(y) / tailweight - skewness)) -
51 np.log(tailweight) - np.log(np.sqrt(y**2 + 1)),
86 self.assertGreater(np.abs(y[0, 0]), np.abs(y[0, 1]))
89 self.assertAllClose(np.abs(y[1, 0]), np.abs(y[1, 1]))
92 self.assertLess(np.abs(y[2, 0]), np.abs(y[2, 1]))
107 x = np.concatenate((-np.logspace(-2, 10, 1000), [0], np.logspace(
[all …]
/external/tensorflow/tensorflow/contrib/crf/python/kernel_tests/
Dcrf_test.py23 import numpy as np namespace
44 transition_params = np.array(
45 [[-3, 5, -2], [3, 4, 1], [1, 2, 1]], dtype=np.float32)
48 np.array(3, dtype=np.int32),
49 np.array(1, dtype=np.int32)
52 np.array([[4, 5, -3], [3, -1, 3], [-1, 2, 1], [0, 0, 0]],
53 dtype=np.float32),
54 np.array([[4, 5, -3]],
55 dtype=np.float32),
58 np.array([1, 2, 1, 0], dtype=np.int32),
[all …]
/external/tensorflow/tensorflow/contrib/sparsemax/python/kernel_tests/
Dsparsemax_loss_test.py21 import numpy as np namespace
36 z = z - np.mean(z, axis=1)[:, np.newaxis]
39 z_sorted = np.sort(z, axis=1)[:, ::-1]
42 z_cumsum = np.cumsum(z_sorted, axis=1)
43 k = np.arange(1, z.shape[1] + 1)
49 k_z = z.shape[1] - np.argmax(z_check[:, ::-1], axis=1)
52 tau_sum = z_cumsum[np.arange(0, z.shape[0]), k_z - 1]
56 return np.maximum(0, z - tau_z)
59 z = z - np.mean(z, axis=1)[:, np.newaxis]
62 z_k = np.sum(q * z, axis=1)
[all …]

12345678910>>...65