/third_party/mindspore/tests/ut/python/nn/probability/distribution/ |
D | test_categorical.py | 23 from mindspore import dtype 33 c = msd.Categorical([0.1, 0.9], dtype=dtype.int32) 39 msd.Categorical([0.1], dtype=dtype.bool_) 57 msd.Categorical([-0.1], dtype=dtype.int32) 59 msd.Categorical([1.1], dtype=dtype.int32) 61 msd.Categorical([0.0], dtype=dtype.int32) 63 msd.Categorical([1.0], dtype=dtype.int32) 71 msd.Categorical([[0.1, 0.2], [0.4, 0.6]], dtype=dtype.int32) 73 msd.Categorical([[0.5, 0.7], [0.6, 0.6]], dtype=dtype.int32) 81 msd.Categorical(0.2, dtype=dtype.int32) [all …]
|
D | test_bernoulli.py | 22 from mindspore import dtype 32 b = msd.Bernoulli([0.1, 0.3, 0.5, 0.9], dtype=dtype.int32) 38 msd.Bernoulli([0.1], dtype=dtype.bool_) 56 msd.Bernoulli([-0.1], dtype=dtype.int32) 58 msd.Bernoulli([1.1], dtype=dtype.int32) 60 msd.Bernoulli([0.0], dtype=dtype.int32) 62 msd.Bernoulli([1.0], dtype=dtype.int32) 72 self.b = msd.Bernoulli(0.5, dtype=dtype.int32) 89 value = Tensor([0, 0, 0, 0, 0], dtype=dtype.float32) 101 self.b = msd.Bernoulli(dtype=dtype.int32) [all …]
|
D | test_uniform.py | 23 from mindspore import dtype 32 msd.Uniform([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32) 37 msd.Uniform(0., 1., dtype=dtype.int32) 56 u = msd.Uniform([3.0], [4.0], dtype=dtype.float32) 65 msd.Uniform(0.0, 0.0, dtype=dtype.float32) 67 msd.Uniform(1.0, 0.0, dtype=dtype.float32) 77 self.u = msd.Uniform(3.0, 4.0, dtype=dtype.float32) 94 value = Tensor([3.1, 3.2, 3.3, 3.4], dtype=dtype.float32) 106 self.u = msd.Uniform(dtype=dtype.float32) 123 value = Tensor([0.1, 0.2, 0.3, 0.9], dtype=dtype.float32) [all …]
|
D | test_geometric.py | 22 from mindspore import dtype 32 g = msd.Geometric([0.1, 0.3, 0.5, 0.9], dtype=dtype.int32) 38 msd.Geometric([0.1], dtype=dtype.bool_) 56 msd.Geometric([-0.1], dtype=dtype.int32) 58 msd.Geometric([1.1], dtype=dtype.int32) 60 msd.Geometric([0.0], dtype=dtype.int32) 62 msd.Geometric([1.0], dtype=dtype.int32) 72 self.g = msd.Geometric(0.5, dtype=dtype.int32) 89 value = Tensor([3, 4, 5, 6, 7], dtype=dtype.float32) 101 self.g = msd.Geometric(dtype=dtype.int32) [all …]
|
D | test_utils.py | 23 from mindspore import dtype 33 tensor_fp16 = Tensor(0.1, dtype=dtype.float16) 34 tensor_fp32 = Tensor(0.1, dtype=dtype.float32) 35 tensor_fp64 = Tensor(0.1, dtype=dtype.float64) 36 tensor_int32 = Tensor(0.1, dtype=dtype.int32) 53 ans1 = set_param_type(dict1, dtype.float16) 54 assert ans1 == dtype.float32 57 set_param_type(dict2, dtype.float32) 59 ans3 = set_param_type(dict3, dtype.float16) 60 assert ans3 == dtype.float32 [all …]
|
D | test_exponential.py | 22 from mindspore import dtype 32 e = msd.Exponential([0.1, 0.3, 0.5, 1.0], dtype=dtype.float32) 37 msd.Exponential([0.1], dtype=dtype.int32) 52 msd.Exponential([-0.1], dtype=dtype.float32) 54 msd.Exponential([0.0], dtype=dtype.float32) 62 self.e = msd.Exponential(0.5, dtype=dtype.float32) 78 value = Tensor([0.2, 0.3, 5.0, 2, 3.9], dtype=dtype.float32) 88 self.e = msd.Exponential(dtype=dtype.float32) 104 value = Tensor([0.2, 0.9, 1, 2, 3], dtype=dtype.float32) 105 rate = Tensor([0.5], dtype=dtype.float32) [all …]
|
D | test_beta.py | 23 from mindspore import dtype 31 msd.Gamma([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32) 35 msd.Gamma([0.], [1.], dtype=dtype.int32) 69 g = msd.Gamma([3.0], [4.0], dtype=dtype.float32) 79 self.gamma = msd.Gamma([3.0, 4.0], [1.0, 1.0], dtype=dtype.float32) 91 value = Tensor([0.5, 1.0], dtype=dtype.float32) 114 value = Tensor([0.5, 1.0], dtype=dtype.float32) 115 concentration1 = Tensor([2.0, 3.0], dtype=dtype.float32) 116 concentration0 = Tensor([1.0], dtype=dtype.float32) 126 self.g1 = msd.Gamma(np.array([3.0]), np.array([4.0]), dtype=dtype.float32) [all …]
|
D | test_lognormal.py | 23 from mindspore import dtype 31 msd.LogNormal([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32) 35 msd.LogNormal(0., 1., dtype=dtype.int32) 57 n = msd.LogNormal([3.0], [4.0], dtype=dtype.float32) 67 self.lognormal = msd.LogNormal(3.0, 4.0, dtype=dtype.float32) 83 value = Tensor([0.5, 1.0], dtype=dtype.float32) 110 value = Tensor([0.5, 1.0], dtype=dtype.float32) 111 mean = Tensor([0.0], dtype=dtype.float32) 112 sd = Tensor([1.0], dtype=dtype.float32) 122 self.n1 = msd.LogNormal(np.array([3.0]), np.array([4.0]), dtype=dtype.float32) [all …]
|
D | test_normal.py | 23 from mindspore import dtype 31 msd.Normal([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32) 35 msd.Normal(0., 1., dtype=dtype.int32) 57 n = msd.Normal([3.0], [4.0], dtype=dtype.float32) 67 self.normal = msd.Normal(3.0, 4.0, dtype=dtype.float32) 83 value = Tensor([0.5, 1.0], dtype=dtype.float32) 110 value = Tensor([0.5, 1.0], dtype=dtype.float32) 111 mean = Tensor([0.0], dtype=dtype.float32) 112 sd = Tensor([1.0], dtype=dtype.float32) 122 self.n1 = msd.Normal(np.array([3.0]), np.array([4.0]), dtype=dtype.float32) [all …]
|
D | test_gamma.py | 23 from mindspore import dtype 31 msd.Gamma([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32) 35 msd.Gamma([0.], [1.], dtype=dtype.int32) 63 g = msd.Gamma([3.0], [4.0], dtype=dtype.float32) 73 self.gamma = msd.Gamma([3.0, 4.0], [1.0, 1.0], dtype=dtype.float32) 89 value = Tensor([0.5, 1.0], dtype=dtype.float32) 116 value = Tensor([0.5, 1.0], dtype=dtype.float32) 117 concentration = Tensor([2.0, 3.0], dtype=dtype.float32) 118 rate = Tensor([1.0], dtype=dtype.float32) 128 self.g1 = msd.Gamma(np.array([3.0]), np.array([4.0]), dtype=dtype.float32) [all …]
|
D | test_poisson.py | 22 from mindspore import dtype 32 p = msd.Poisson([0.1, 0.3, 0.5, 1.0], dtype=dtype.float32) 37 msd.Poisson([0.1], dtype=dtype.bool_) 52 msd.Poisson([-0.1], dtype=dtype.float32) 54 msd.Poisson([0.0], dtype=dtype.float32) 66 self.p = msd.Poisson([0.5, 0.5, 0.5, 0.5, 0.5], dtype=dtype.float32) 82 value = Tensor([0.2, 0.3, 5.0, 2, 3.9], dtype=dtype.float32) 92 self.p = msd.Poisson(dtype=dtype.float32) 108 value = Tensor([0.2, 0.9, 1, 2, 3], dtype=dtype.float32) 109 rate = Tensor([0.5, 0.5, 0.5, 0.5, 0.5], dtype=dtype.float32) [all …]
|
D | test_cauchy.py | 22 from mindspore import dtype 30 msd.Cauchy([[2.], [1.]], [[2.], [3.], [4.]], dtype=dtype.float32) 34 msd.Cauchy(0., 1., dtype=dtype.int32) 56 l = msd.Cauchy([3.0], [4.0], dtype=dtype.float32) 66 self.cauchy = msd.Cauchy(3.0, 4.0, dtype=dtype.float32) 82 value = Tensor([0.5, 1.0], dtype=dtype.float32) 109 value = Tensor([0.5, 1.0], dtype=dtype.float32) 110 mu = Tensor([0.0], dtype=dtype.float32) 111 s = Tensor([1.0], dtype=dtype.float32) 136 mu = Tensor([0.0], dtype=dtype.float32) [all …]
|
/third_party/mindspore/tests/st/ops/gpu/ |
D | test_random_categorical_op.py | 26 def __init__(self, num_sample, seed=0, dtype=ms.int64): argument 28 self.rc = P.RandomCategorical(dtype) 43 dtype = ms.int64 44 …expect = np.array([[4, 3, 2, 4, 4, 4, 3, 4, 1, 3], [4, 3, 2, 4, 4, 4, 3, 4, 1, 3]], dtype=np.int64) 46 random_cateogoric = RCnet(num_sample, seed, dtype) 49 assert expect.dtype == output.asnumpy().dtype 58 dtype = ms.int64 59 …expect = np.array([[4, 3, 2, 4, 4, 4, 3, 4, 1, 3], [4, 3, 2, 4, 4, 4, 3, 4, 1, 3]], dtype=np.int64) 61 random_cateogoric = RCnet(num_sample, seed, dtype) 64 assert expect.dtype == output.asnumpy().dtype [all …]
|
D | test_prelu_op.py | 24 from mindspore.common import dtype as mstype 49 assert result.dtype == expect.dtype 80 for dtype in dtypes: 81 x = Tensor(x, dtype) 82 weight = Tensor(weight, dtype) 83 expect_forward = Tensor(expect_forward, dtype) 84 expect_dx = Tensor(expect_dx, dtype) 85 expect_dw = Tensor(expect_dw, dtype) 121 for dtype in dtypes: 122 x = Tensor(x, dtype) [all …]
|
/third_party/mindspore/tests/ut/python/pynative_mode/ |
D | test_implicit_conversion.py | 29 x = Tensor(np.array([[0.1, 0.2, 0.3], [0.4, 0.5, 0.6]], dtype=np.float32)) 32 ret_expect = Tensor(np.array([[2.1, 2.2, 2.3], [2.4, 2.5, 2.6]], dtype=np.float32)) 33 assert ret_actual.dtype == ret_expect.dtype 38 x = Tensor(np.array([[True, False], [False, True]], dtype=np.bool_)) 41 ret_expect = Tensor(np.array([[4.3, 3.3], [3.3, 4.3]], dtype=np.float32)) 42 assert ret_actual.dtype == ret_expect.dtype 47 x = Tensor(np.array([[True, False], [False, True]], dtype=np.bool_)) 50 ret_expect = Tensor(np.array([[4, 3], [3, 4]], dtype=np.int64)) 51 assert ret_actual.dtype == ret_expect.dtype 57 y = Tensor(np.array([[1, 2, 3], [4, 5, 6]], dtype=np.int32)) [all …]
|
/third_party/mindspore/mindspore/numpy/ |
D | math_ops.py | 20 from numpy import dtype as nptype 26 from ..common import dtype as mstype 69 def absolute(x, dtype=None): argument 100 original_dtype = x.dtype 101 if not _check_is_float(original_dtype) and dtype is None: 103 return _apply_tensor_op(F.absolute, x, dtype=dtype).astype(original_dtype) 104 return _apply_tensor_op(F.absolute, x, dtype=dtype) 145 def clip(x, xmin, xmax, dtype=None): argument 185 x = maximum(x, xmin, dtype=dtype) 187 x = minimum(x, xmax, dtype=dtype) [all …]
|
D | array_creations.py | 22 from ..common import dtype as mstype 53 def array(obj, dtype=None, copy=True, ndmin=0): argument 86 if dtype is not None: 87 dtype = _check_dtype(dtype) 88 res = asarray(obj, dtype) 97 elif dtype is not None and dtype != res.dtype: 98 res = res.astype(dtype) 104 def asarray_const(a, dtype=None): argument 108 if dtype is not None: 109 dtype = _check_dtype(dtype) [all …]
|
D | logic_ops.py | 19 from ..common import dtype as mstype 29 def not_equal(x1, x2, dtype=None): argument 63 return _apply_tensor_op(F.not_equal, x1, x2, dtype=dtype) 66 def less_equal(x1, x2, dtype=None): argument 96 return _apply_tensor_op(F.tensor_le, x1, x2, dtype=dtype) 99 def less(x1, x2, dtype=None): argument 128 return _apply_tensor_op(F.tensor_lt, x1, x2, dtype=dtype) 131 def greater_equal(x1, x2, dtype=None): argument 160 return _apply_tensor_op(F.tensor_ge, x1, x2, dtype=dtype) 163 def greater(x1, x2, dtype=None): argument [all …]
|
/third_party/mindspore/tests/ut/python/mindrecord/ |
D | test_mindrecord_exception.py | 472 … = [{"filename": "001.jpg", "label": 43, "score": 0.8, "mask": np.array([3, 6, 9], dtype=np.int64), 473 "segments": np.array([[5.0, 1.6], [65.2, 8.3]], dtype=np.float32), 475 … {"filename": "002.jpg", "label": 91, "score": 5.4, "mask": np.array([1, 4, 7], dtype=np.int64), 476 "segments": np.array([[5.1, 9.1], [2.0, 65.4]], dtype=np.float32), 478 … {"filename": "003.jpg", "label": 61, "score": 6.4, "mask": np.array([7, 6, 3], dtype=np.int64), 479 "segments": np.array([[0.0, 5.6], [3.0, 16.3]], dtype=np.float32), 481 … {"filename": "004.jpg", "label": 29, "score": 8.1, "mask": np.array([2, 8, 0], dtype=np.int64), 482 "segments": np.array([[5.9, 7.2], [4.0, 89.0]], dtype=np.float32), 484 … {"filename": "005.jpg", "label": 78, "score": 7.7, "mask": np.array([3, 1, 2], dtype=np.int64), 485 "segments": np.array([[0.6, 8.1], [5.3, 49.3]], dtype=np.float32), [all …]
|
/third_party/boost/libs/python/src/numpy/ |
D | dtype.cpp | 14 dtype(python::detail::new_reference(reinterpret_cast<PyObject*>(PyArray_DescrFromType(code)))) 19 static dtype get() { return DTYPE_FROM_CODE(NPY_INT ## bits);} \ 23 static dtype get() { return DTYPE_FROM_CODE(NPY_UINT ## bits);} \ 25 template BOOST_NUMPY_DECL dtype get_int_dtype<bits, false>(); \ 26 template BOOST_NUMPY_DECL dtype get_int_dtype<bits, true>() 31 static dtype get() { return DTYPE_FROM_CODE(NPY_FLOAT ## bits);} \ 33 template BOOST_NUMPY_DECL dtype get_float_dtype<bits>() 38 static dtype get() { return DTYPE_FROM_CODE(NPY_COMPLEX ## bits);} \ 40 template BOOST_NUMPY_DECL dtype get_complex_dtype<bits>() 43 NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayDescr_Type, numpy::dtype) [all …]
|
/third_party/mindspore/tests/ut/python/nn/probability/bijector/ |
D | test_bijector.py | 22 from mindspore import dtype 31 super(MyBijector, self).__init__(name='MyBijector', dtype=None, param=param) 57 … super(MySecondBijector, self).__init__(name='MySecondBijector', dtype=dtype.float32, param=param) 84 param1_2 = Tensor(1.0, dtype=dtype.float16) 85 param2_2 = Tensor(2.0, dtype=dtype.float32) 92 param1_3 = Tensor(1.0, dtype=dtype.float32) 93 param2_3 = Tensor(2.0, dtype=dtype.float32) 109 MyBijector(Tensor([1, 2], dtype=dtype.int32), Tensor([1, 2], dtype=dtype.int32)) 119 param1_2 = Tensor(1.0, dtype=dtype.float16) 120 param2_2 = Tensor(2.0, dtype=dtype.float32) [all …]
|
/third_party/mindspore/tests/st/probability/distribution/ |
D | test_uniform.py | 22 from mindspore import dtype 32 self.u = msd.Uniform([0.0], [[1.0], [2.0]], dtype=dtype.float32) 44 x_ = Tensor(np.array([-1.0, 0.0, 0.5, 1.0, 1.5, 3.0]).astype(np.float32), dtype=dtype.float32) 55 self.u = msd.Uniform([0.0], [[1.0], [2.0]], dtype=dtype.float32) 67 x_ = Tensor(np.array([0.5]).astype(np.float32), dtype=dtype.float32) 78 self.u = msd.Uniform([0.0], [1.5], dtype=dtype.float32) 93 output = kl(Tensor(low_b, dtype=dtype.float32), Tensor(high_b, dtype=dtype.float32)) 103 self.u = msd.Uniform([0.0], [3.0], dtype=dtype.float32) 126 self.u = msd.Uniform([0.0], [[1.0], [2.0]], seed=seed, dtype=dtype.float32) 138 low = Tensor([1.0], dtype=dtype.float32) [all …]
|
/third_party/mindspore/tests/ut/python/nn/ |
D | test_transformer.py | 19 from mindspore.common import dtype 34 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32) 35 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16) 51 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32) 52 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16) 67 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32) 68 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16) 83 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32) 84 encoder_input_mask = Tensor(np.ones((2, 20, 20)), dtype.float16) 98 encoder_input_value = Tensor(np.ones((2, 20, 64)), dtype.float32) [all …]
|
D | test_nn_embedding.py | 20 from mindspore.common import dtype 29 input_data = Tensor(np.ones([8, 128]), dtype.int32) 36 input_data = Tensor(np.ones([8, 128]), dtype.int32) 43 input_data = Tensor(np.ones([8, 128]), dtype.int32) 59 dtype.int64, dtype.float32, dtype.int32) 66 dtype.int16, dtype.float32, dtype.int32) 73 dtype.int16, dtype.float16, dtype.int32) 80 dtype.int16, dtype.float32, dtype.int16) 87 dtype.int16, dtype.float32, dtype.int16) 94 dtype.int16, dtype.float32, dtype.int16)
|
/third_party/boost/boost/python/numpy/ |
D | dtype.hpp | 28 class BOOST_NUMPY_DECL dtype : public object { class 34 explicit dtype(T arg, bool align=false) : object(convert(arg, align)) {} in dtype() function in boost::python::numpy::dtype 47 template <typename T> static dtype get_builtin(); 58 friend BOOST_NUMPY_DECL bool equivalent(dtype const & a, dtype const & b); 68 BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(dtype, object); 72 BOOST_NUMPY_DECL bool equivalent(dtype const & a, dtype const & b); 77 template <int bits, bool isUnsigned> dtype get_int_dtype(); 79 template <int bits> dtype get_float_dtype(); 81 template <int bits> dtype get_complex_dtype(); 88 static dtype get() { return get_int_dtype< 8*sizeof(T), boost::is_unsigned<T>::value >(); } in get() [all …]
|