/external/tensorflow/tensorflow/compiler/tests/ |
D | binary_ops_test.py | 48 pa = array_ops.placeholder(dtypes.as_dtype(a.dtype), a.shape, name="a") 49 pb = array_ops.placeholder(dtypes.as_dtype(b.dtype), b.shape, name="b") 55 rtol = 1e-15 if a.dtype == np.float64 else 1e-3 57 atol = 1e-15 if a.dtype == np.float64 else 1e-6 72 for dtype in self.float_types: 73 if dtype == dtypes.bfloat16.as_numpy_dtype: 82 np.array([[[[-1, 2.00009999], [-3, b]]]], dtype=dtype), 83 np.array([[[[a, 2], [-3.00009, 4]]]], dtype=dtype), 84 expected=np.array([[[[False, True], [True, False]]]], dtype=dtype)) 88 np.array([3, 3, -1.5, -8, 44], dtype=dtype), [all …]
|
D | unary_ops_test.py | 68 dtypes.as_dtype(inp.dtype), inp.shape, name="a") 72 self.assertEqual(output.dtype, expected.dtype) 94 for dtype in self.numeric_types - {np.int8, np.uint8}: 96 array_ops.diag, np.array([1, 2, 3, 4], dtype=dtype), 99 dtype=dtype)) 102 np.arange(36).reshape([2, 3, 2, 3]).astype(dtype), 103 np.array([[0, 7, 14], [21, 28, 35]], dtype=dtype)) 105 array_ops.diag, np.array([[1, 2], [3, 4]], dtype=dtype), 109 dtype=dtype)) 113 np.array([[-1, 1]], dtype=dtype), [all …]
|
D | ternary_ops_test.py | 35 pa = array_ops.placeholder(dtypes.as_dtype(a.dtype), a.shape, name="a") 36 pb = array_ops.placeholder(dtypes.as_dtype(b.dtype), b.shape, name="b") 37 pc = array_ops.placeholder(dtypes.as_dtype(c.dtype), c.shape, name="c") 50 expected = np.linspace(start, end, num, dtype=np.float32) 68 expected=np.array([1], dtype=np.int32)) 74 expected=np.array([1, 3, 5], dtype=np.int32)) 77 for dtype in self.numeric_types: 81 np.array(2, dtype=dtype), 82 np.array(7, dtype=dtype), 83 expected=np.array(7, dtype=dtype)) [all …]
|
D | nary_ops_test.py | 35 array_ops.placeholder(dtypes.as_dtype(arg.dtype), arg.shape) 55 [np.array([[1, 2, 3]], dtype=np.float32)], 56 expected=np.array([[1, 2, 3]], dtype=np.float32)) 59 [np.array([1, 2], dtype=np.float32), 60 np.array([10, 20], dtype=np.float32)], 61 expected=np.array([11, 22], dtype=np.float32)) 63 [np.array([-4], dtype=np.float32), 64 np.array([10], dtype=np.float32), 65 np.array([42], dtype=np.float32)], 66 expected=np.array([48], dtype=np.float32)) [all …]
|
D | segment_reduction_ops_test.py | 33 d = array_ops.placeholder(data.dtype, shape=data.shape) 37 i = array_ops.placeholder(indices.dtype, shape=indices.shape) 57 for dtype in self.numeric_types: 62 dtype=dtype), 64 np.array([0, 1, 2, 3, 4, 5], dtype=dtype), 2, 4)) 67 for dtype in self.numeric_types: 69 np.array([1, 3, 2, 9], dtype=dtype), 71 np.array([0, 1, 2, 3, 4, 5], dtype=dtype), 72 np.array([3, 0, 2, 1, 3, 3], dtype=np.int32), 4)) 75 for dtype in self.numeric_types: [all …]
|
/external/pytorch/torch/ao/quantization/fx/ |
D | _decomposed.py | 27 # Helper to check the passed in quant min and max are valid for the dtype 28 def _quant_min_max_bounds_check(quant_min, quant_max, dtype): argument 29 if dtype not in _DTYPE_TO_QVALUE_BOUNDS: 30 raise ValueError(f"Unsupported dtype: {dtype}") 31 quant_min_lower_bound, quant_max_upper_bound = _DTYPE_TO_QVALUE_BOUNDS[dtype] 34 "quant_min out of bound for dtype, " 39 "quant_max out of bound for dtype, " 46 "int quant_min, int quant_max, ScalarType dtype) -> Tensor" 57 dtype: torch.dtype, argument 68 dtype (torch.dtype): requested dtype (e.g. torch.uint8) for output Tensor [all …]
|
/external/tensorflow/tensorflow/compiler/mlir/tfrt/jit/python_binding/ |
D | conversion_utils.cc | 21 #include "tfrt/dtype/dtype.h" // from @tf_runtime 25 using ::tfrt::DType; 29 // Returns Python buffer protocol's type string from TFRT's dtype. 30 const char* ToPythonStructFormat(DType dtype_kind) { in ToPythonStructFormat() 34 case DType::Invalid: in ToPythonStructFormat() 35 throw std::runtime_error("Invalid dtype."); in ToPythonStructFormat() 36 case DType::Unsupported: in ToPythonStructFormat() 37 throw std::runtime_error("Unsupported dtype."); in ToPythonStructFormat() 38 case DType::UI8: in ToPythonStructFormat() 40 case DType::UI16: in ToPythonStructFormat() [all …]
|
/external/tensorflow/tensorflow/python/ops/ |
D | math_grad_test.py | 68 def _testGrad(self, shape, dtype=None, max_error=None, bias=None, sigma=None): argument 70 if dtype in (dtypes.complex64, dtypes.complex128): 79 shape, bias=bias), dtype=dtype) 91 [3, 3], dtype=dtypes.float32, max_error=2e-5, bias=0.1, sigma=1.0) 93 [3, 3], dtype=dtypes.complex64, max_error=2e-5, bias=0.1, sigma=1.0) 97 [3, 3], dtype=dtypes.float32, max_error=100.0, bias=0.0, sigma=0.1) 99 [3, 3], dtype=dtypes.complex64, max_error=100.0, bias=0.0, sigma=0.1) 106 inputs = constant_op.constant([1.0], dtype=dtypes.float32) 114 inputs = constant_op.constant([1.0], dtype=dtypes.float32) 125 inputs = constant_op.constant([1.0, 2.0, 3.0, 4.0], dtype=dtypes.float32) [all …]
|
D | init_ops_v2.py | 42 def __call__(self, shape, dtype=None, **kwargs): 43 # returns a tensor of shape `shape` and dtype `dtype` 48 def __call__(self, shape, dtype=None, **kwargs): argument 53 dtype: Optional dtype of the tensor. If not provided will return tensor 95 config.pop("dtype", None) 115 the Initializer object, without knowing the shape and dtype of the variable 121 ... return (tf.Variable(initializer(shape=[k], dtype=tf.float32)), 122 ... tf.Variable(initializer(shape=[k, k], dtype=tf.float32))) 125 <tf.Variable ... shape=(3,) ... numpy=array([0., 0., 0.], dtype=float32)> 130 [0., 0., 0.]], dtype=float32)> [all …]
|
/external/tensorflow/tensorflow/python/ops/signal/ |
D | window_ops.py | 31 def _check_params(window_length, dtype): argument 32 """Check window_length and dtype params. 36 dtype: The data type to produce. Must be a floating point type. 42 ValueError: If `dtype` is not a floating point type or window_length is not 45 if not dtype.is_floating: 46 raise ValueError('dtype must be a floating point type. Found %s' % dtype) 47 window_length = ops.convert_to_tensor(window_length, dtype=dtypes.int32) 54 def kaiser_window(window_length, beta=12., dtype=dtypes.float32, name=None): argument 60 dtype: The data type to produce. Must be a floating point type. 64 A `Tensor` of shape `[window_length]` of type `dtype`. [all …]
|
/external/executorch/exir/dialects/edge/arg/ |
D | model.py | 29 dtype=None, argument 39 self.dtype_given = dtype is not None 44 self.dtype = torch.float if dtype is None else dtype 84 def get_random_tensor(self, size, dtype): argument 86 if dtype == torch.bool: 88 return torch.full(size, True, dtype=dtype) 90 return torch.randint(low=0, high=2, size=size, dtype=dtype) 92 if dtype in common_dtype.integral_types(): 94 elif dtype in common_dtype.floating_types(): 97 raise ValueError(f"Unsupported Dtype: {dtype}") [all …]
|
/external/tensorflow/tensorflow/python/kernel_tests/math_ops/ |
D | sets_test.py | 38 def _values(values, dtype): argument 41 dtype=(np.str_ if (dtype == dtypes.string) else dtype.as_numpy_dtype)) 44 def _constant(values, dtype): argument 45 return constant_op.constant(_values(values, dtype), dtype=dtype) 48 def _dense_to_sparse(dense, dtype): argument 60 values.append(str(cell) if dtype == dtypes.string else cell) 65 constant_op.constant(values, dtype), 73 for dtype in _DTYPES: 74 self._test_set_size_2d(dtype) 76 def _test_set_size_2d(self, dtype): argument [all …]
|
/external/pytorch/test/torch_np/numpy_tests/core/ |
D | test_dtype.py | 56 dt = np.dtype(t) 61 intp = np.dtype(np.intp) 64 right = np.dtype(np.int32) 67 right = np.dtype(np.int64) 75 assert_raises(TypeError, np.dtype, "O3") 76 assert_raises(TypeError, np.dtype, "O5") 77 assert_raises(TypeError, np.dtype, "O7") 78 assert_raises(TypeError, np.dtype, "b3") 79 assert_raises(TypeError, np.dtype, "h4") 80 assert_raises(TypeError, np.dtype, "I5") [all …]
|
/external/pytorch/torch/_numpy/ |
D | _reductions_impl.py | 6 Anything here only deals with torch objects, e.g. "dtype" is a torch.dtype instance etc 52 def _atleast_float(dtype, other_dtype): argument 53 """Return a dtype that is real or complex floating-point. 56 float dtype; inputs that are complex get converted to the default complex 57 dtype; real floating-point dtypes (`float*`) get passed through unchanged 59 if dtype is None: 60 dtype = other_dtype 61 if not (dtype.is_floating_point or dtype.is_complex): 63 return dtype 80 raise NotImplementedError(f"argmax with dtype={a.dtype}.") [all …]
|
/external/pytorch/aten/src/ATen/cuda/ |
D | CUDABlas.h | 5 gemm<Dtype>(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, 8 gemv<Dtype>(transa, m, n, alpha, a, lda, x, incx, beta, y, incy) 10 dot<Dtype>(n, x, incx, y, incy, result) 12 where Dtype is double, float, at::Half or at::BFloat16 (ROCm, NOT for dot). 42 #define CUDABLAS_GEMM_ARGTYPES(Dtype) \ argument 43 char transa, char transb, int64_t m, int64_t n, int64_t k, at::opmath_type<Dtype> alpha, \ 44 const Dtype *a, int64_t lda, const Dtype *b, int64_t ldb, at::opmath_type<Dtype> beta,\ 45 Dtype *c, int64_t ldc 47 #define CUDABLAS_GEMM_ARGS(Dtype) transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc argument 49 template <typename Dtype> [all …]
|
/external/tensorflow/tensorflow/python/training/ |
D | ftrl_test.py | 38 for dtype in [dtypes.half, dtypes.float32]: 42 dtype=dtype) 44 dtype=dtype) 46 var0 = variables.Variable([0.0, 0.0], dtype=dtype) 47 var1 = variables.Variable([0.0, 0.0], dtype=dtype) 48 grads0 = constant_op.constant([0.1, 0.2], dtype=dtype) 49 grads1 = constant_op.constant([0.01, 0.02], dtype=dtype) 81 for dtype in [dtypes.half, dtypes.float32]: 83 var0 = variables.Variable([1.0, 2.0], dtype=dtype) 84 var1 = variables.Variable([4.0, 3.0], dtype=dtype) [all …]
|
/external/python/cpython3/Modules/_testcapi/ |
D | pyatomic.c | 34 #define IMPL_TEST_ADD(suffix, dtype) \ argument 37 dtype x = 0; \ 47 assert(x == (dtype)-1); \ 48 assert(_Py_atomic_add_##suffix(&x, -2) == (dtype)-1); \ 49 assert(x == (dtype)-3); \ 50 assert(_Py_atomic_add_##suffix(&x, 2) == (dtype)-3); \ 51 assert(x == (dtype)-1); \ 56 #define IMPL_TEST_COMPARE_EXCHANGE(suffix, dtype) \ argument 59 dtype x = (dtype)0; \ 60 dtype y = (dtype)1; \ [all …]
|
/external/pytorch/test/ |
D | test_unary_ufuncs.py | 86 def test_float_domains(self, device, dtype, op): argument 92 low_tensor = torch.tensor(low, device=device, dtype=dtype) 98 # and the dtype is imprecise (like bfloat16 is) 113 high_tensor = torch.tensor(high, device=device, dtype=dtype) 134 self, actual, expected, msg, *, dtype, exact_dtype=True, **kwargs argument 142 # Handles exact dtype comparisons between arrays and tensors 145 actual.dtype is torch.bfloat16 146 or expected.dtype != torch_to_numpy_dtype_dict[actual.dtype] 148 # Allows array dtype to be float32 when comparing with bfloat16 tensors 149 # since NumPy doesn't support the bfloat16 dtype [all …]
|
D | test_type_promotion.py | 29 # the default dtype being torch.float and again with the default dtype 51 int_tensor = torch.ones([4, 4, 4], dtype=torch.int32, device=device) 55 expected = torch.ones([4, 4, 4], dtype=torch.int32, device=device) 57 long_tensor = torch.ones([4, 4, 4], dtype=torch.int64, device=device) 62 self.assertEqual(int_tensor.dtype, torch.int32) 64 bool_tensor = torch.tensor([1, 1, 1], dtype=torch.bool, device=device) 65 uint8_tensor = torch.tensor([1, 1, 1], dtype=torch.uint8, device=device) 75 int16_tensor = torch.tensor([1, 1, 1], dtype=torch.int16, device=device) 80 dont_promote = torch.ones(3, dtype=torch.uint8, device=device) + 5 81 self.assertEqual(dont_promote.dtype, torch.uint8) [all …]
|
D | test_scatter_gather_ops.py | 16 # Protects against includes accidentally setting the default dtype 38 def test_gather(self, device, dtype): argument 43 src = make_tensor((m, n, o), device=device, dtype=dtype) 46 idx = make_tensor(idx_size, device=device, dtype=torch.long) 50 expected = torch.zeros(idx_size, device=device, dtype=dtype) 60 if not dtype.is_complex: 61 src = make_tensor((3, 4, 5), device=device, dtype=dtype) 67 def test_gather_bool(self, device, dtype): argument 68 src = torch.tensor(((False, True), (True, True)), device=device, dtype=dtype) 69 idx = torch.tensor(((0, 0), (1, 0)), device=device, dtype=torch.long) [all …]
|
D | test_binary_ufuncs.py | 85 self, actual, expected, msg, *, dtype, exact_dtype=True, **kwargs argument 93 # Handles exact dtype comparisons between arrays and tensors 95 # Allows array dtype to be float32 when comparing with bfloat16 tensors 96 # since NumPy doesn't support the bfloat16 dtype 99 if expected.dtype == np.float32: 100 assert actual.dtype in ( 106 assert expected.dtype == torch_to_numpy_dtype_dict[actual.dtype] 110 torch.from_numpy(expected).to(actual.dtype), 120 def _test_reference_numerics(self, dtype, op, gen, equal_nan=True): argument 125 numpy_to_torch_dtype_dict[expected.dtype.type], dtype [all …]
|
D | test_complex.py | 19 def test_to_list(self, device, dtype): argument 23 torch.zeros((2, 2), device=device, dtype=dtype).tolist(), 28 def test_dtype_inference(self, device, dtype): argument 30 with set_default_dtype(dtype): 32 if dtype == torch.float16: 33 self.assertEqual(x.dtype, torch.chalf) 34 elif dtype == torch.float32: 35 self.assertEqual(x.dtype, torch.cfloat) 37 self.assertEqual(x.dtype, torch.cdouble) 40 def test_conj_copy(self, device, dtype): argument [all …]
|
D | test_tensor_creation_ops.py | 35 def _generate_input(shape, dtype, device, with_extremal): argument 37 x = torch.tensor((), dtype=dtype, device=device) 39 if dtype.is_floating_point or dtype.is_complex: 41 if dtype == torch.bfloat16: 45 x = torch.randn(*shape, dtype=dtype, device=device) * random.randint(30, 100) 47 if with_extremal and dtype.is_floating_point: 52 elif with_extremal and dtype.is_complex: 56 elif dtype == torch.bool: 57 x = torch.zeros(shape, dtype=dtype, device=device) 60 x = torch.randint(15, 100, shape, dtype=dtype, device=device) [all …]
|
/external/tensorflow/tensorflow/python/kernel_tests/array_ops/ |
D | one_hot_op_test.py | 32 dtype=None, argument 37 array_ops.one_hot(dtype=dtype, **inputs) 39 ans = array_ops.one_hot(dtype=dtype, **inputs) 43 if dtype: 44 self.assertEqual(tf_ans.dtype, dtype) 54 def _testBasic(self, dtype): argument 55 indices = np.asarray([0, 2, -1, 1], dtype=np.int64) 57 on_value = np.asarray(1.0, dtype=dtype) 58 off_value = np.asarray(-1.0, dtype=dtype) 63 dtype=dtype) [all …]
|
/external/pytorch/torch/masked/ |
D | _ops.py | 15 from torch.types import _dtype as DType unknown 19 # The JIT doesn't understand Union, nor torch.dtype here 20 DType = int variable 87 dtype=torch.bool)``. 116 reduction, depends on input dtype. For instance, for float32, uint8, 168 sum=(("dim",), ("keepdim=False", "dtype=None", "mask=None")), 169 prod=(("dim",), ("keepdim=False", "dtype=None", "mask=None")), 170 cumsum=(("dim__as_int",), ("dtype=None", "mask=None")), 171 cumprod=(("dim__as_int",), ("dtype=None", "mask=None")), 172 amin=(("dim",), ("keepdim=False", "dtype=None", "mask=None")), [all …]
|