Home
last modified time | relevance | path

Searched refs:ndarray (Results 1 – 25 of 128) sorted by relevance

123456

/third_party/boost/boost/python/numpy/
Dndarray.hpp32 class BOOST_NUMPY_DECL ndarray : public object class
78 BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(ndarray, object);
81 ndarray view(dtype const & dt) const;
84 ndarray astype(dtype const & dt) const;
87 ndarray copy() const;
125 ndarray transpose() const;
128 ndarray squeeze() const;
131 ndarray reshape(python::tuple const & shape) const;
145 BOOST_NUMPY_DECL ndarray zeros(python::tuple const & shape, dtype const & dt);
146 BOOST_NUMPY_DECL ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt);
[all …]
Dufunc.hpp108 ndarray in_array = from_object(input, in_dtype, ndarray::ALIGNED); in call()
109 ndarray out_array = ! output.is_none() ? in call()
110 from_object(output, out_dtype, ndarray::ALIGNED | ndarray::WRITEABLE) in call()
171 ndarray in1_array = from_object(input1, in1_dtype, ndarray::ALIGNED); in call()
172 ndarray in2_array = from_object(input2, in2_dtype, ndarray::ALIGNED); in call()
174 ndarray out_array = !output.is_none() in call()
175 ? from_object(output, out_dtype, ndarray::ALIGNED | ndarray::WRITEABLE) in call()
Dmatrix.hpp32 class BOOST_NUMPY_DECL matrix : public ndarray
38 BOOST_PYTHON_FORWARD_OBJECT_CONSTRUCTORS(matrix, ndarray);
42 : ndarray(extract<ndarray>(construct(obj, dt, copy))) {} in matrix()
46 : ndarray(extract<ndarray>(construct(obj, copy))) {} in matrix()
/third_party/boost/libs/python/doc/numpy/reference/
Dndarray.rst1 ndarray title
6 A `ndarray`_ is an N-dimensional array which contains items of the same type and size, where N is t…
8 .. _ndarray: http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html target
11 …``<boost/python/numpy/ndarray.hpp>`` contains the structures and methods necessary to move raw dat…
27 class ndarray : public object
41 ndarray view(dtype const & dt) const;
42 ndarray astype(dtype const & dt) const;
43 ndarray copy() const;
56 ndarray transpose() const;
57 ndarray squeeze() const;
[all …]
/third_party/boost/libs/python/doc/html/numpy/_sources/reference/
Dndarray.rst.txt1 ndarray
6 A `ndarray`_ is an N-dimensional array which contains items of the same type and size, where N is t…
8 .. _ndarray: http://docs.scipy.org/doc/numpy/reference/arrays.ndarray.html
11 …``<boost/python/numpy/ndarray.hpp>`` contains the structures and methods necessary to move raw dat…
27 class ndarray : public object
41 ndarray view(dtype const & dt) const;
42 ndarray astype(dtype const & dt) const;
43 ndarray copy() const;
56 ndarray transpose() const;
57 ndarray squeeze() const;
[all …]
/third_party/boost/libs/python/src/numpy/
Dndarray.cpp14 NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArray_Type, numpy::ndarray)
22 ndarray::bitflag numpy_to_bitflag(int const f) in numpy_to_bitflag()
24 ndarray::bitflag r = ndarray::NONE; in numpy_to_bitflag()
25 if (f & NPY_ARRAY_C_CONTIGUOUS) r = (r | ndarray::C_CONTIGUOUS); in numpy_to_bitflag()
26 if (f & NPY_ARRAY_F_CONTIGUOUS) r = (r | ndarray::F_CONTIGUOUS); in numpy_to_bitflag()
27 if (f & NPY_ARRAY_ALIGNED) r = (r | ndarray::ALIGNED); in numpy_to_bitflag()
28 if (f & NPY_ARRAY_WRITEABLE) r = (r | ndarray::WRITEABLE); in numpy_to_bitflag()
32 int bitflag_to_numpy(ndarray::bitflag f) in bitflag_to_numpy()
35 if (f & ndarray::C_CONTIGUOUS) r |= NPY_ARRAY_C_CONTIGUOUS; in bitflag_to_numpy()
36 if (f & ndarray::F_CONTIGUOUS) r |= NPY_ARRAY_F_CONTIGUOUS; in bitflag_to_numpy()
[all …]
/third_party/boost/libs/python/test/numpy/
Dndarray.cpp12 np::ndarray zeros(p::tuple shape, np::dtype dt) { return np::zeros(shape, dt);} in zeros()
13 np::ndarray array2(p::object obj, np::dtype dt) { return np::array(obj,dt);} in array2()
14 np::ndarray array1(p::object obj) { return np::array(obj);} in array1()
15 np::ndarray empty1(p::tuple shape, np::dtype dt) { return np::empty(shape,dt);} in empty1()
17 np::ndarray c_empty(p::tuple shape, np::dtype dt) in c_empty()
25 np::ndarray result = np::empty(len, c_shape, dt); in c_empty()
30 np::ndarray transpose(np::ndarray arr) { return arr.transpose();} in transpose()
31 np::ndarray squeeze(np::ndarray arr) { return arr.squeeze();} in squeeze()
32 np::ndarray reshape(np::ndarray arr,p::tuple tup) { return arr.reshape(tup);} in reshape()
34 Py_intptr_t shape_index(np::ndarray arr,int k) { return arr.shape(k); } in shape_index()
[all …]
Dindexing.cpp13 p::object single(np::ndarray ndarr, int i) { return ndarr[i];} in single()
14 p::object slice(np::ndarray ndarr, p::slice sl) { return ndarr[sl];} in slice()
15 p::object indexarray(np::ndarray ndarr, np::ndarray d1) { return ndarr[d1];} in indexarray()
16 p::object indexarray_2d(np::ndarray ndarr, np::ndarray d1,np::ndarray d2) { return ndarr[p::make_tu… in indexarray_2d()
17 p::object indexslice(np::ndarray ndarr, np::ndarray d1, p::slice sl) { return ndarr[p::make_tuple(d… in indexslice()
Dshapes.cpp12 np::ndarray reshape(np::ndarray old_array, p::tuple shape) in reshape()
14 np::ndarray local_shape = old_array.reshape(shape); in reshape()
Dtemplates.cpp20 explicit ArrayFiller(np::ndarray const & arg) : argument(arg) {} in ArrayFiller()
50 np::ndarray argument;
53 void fill(np::ndarray const & arg) in fill()
/third_party/python/Lib/test/
Dtest_buffer.py30 ndarray = None variable
45 from numpy import ndarray as numpy_array
628 return ndarray(items, shape=shape, strides=strides, format=fmt,
738 if isinstance(nd, ndarray):
765 @unittest.skipUnless(ndarray, 'ndarray object required for this test')
817 if isinstance(result, ndarray) or is_memoryview_format(fmt):
872 expected = ndarray(trans, shape=shape, format=ff,
878 expected = ndarray(flattened, shape=shape, format=ff)
901 y = ndarray(initlst, shape=shape, flags=ro, format=fmt)
921 y = ndarray(initlst, shape=shape, flags=ro|ND_FORTRAN,
[all …]
Dtest_picklebuffer.py78 ndarray = import_helper.import_module("_testbuffer").ndarray
79 arr = ndarray(list(range(12)), shape=(4, 3), format='<i')
91 arr = ndarray(list(range(12)), shape=(3, 4), strides=(4, 12), format='<i')
112 ndarray = import_helper.import_module("_testbuffer").ndarray
113 arr = ndarray(list(range(3)), shape=(3,), format='<h')
117 arr = ndarray(list(range(6)), shape=(2, 3), format='<h')
121 arr = ndarray(list(range(6)), shape=(2, 3), strides=(2, 4),
127 arr = ndarray(456, shape=(), format='<i')
138 ndarray = import_helper.import_module("_testbuffer").ndarray
139 arr = ndarray(list(range(6)), shape=(6,), format='<i')[::2]
[all …]
/third_party/boost/libs/python/doc/numpy/tutorial/
Dfromdata.rst4 One of the advantages of the ndarray wrapper is that the same data can be used in both Python and C…
20 Create an array in C++ , and pass the pointer to it to the from_data method to create an ndarray::
23 np::ndarray py_array = np::from_data(arr, np::dtype::get_builtin<int>(),
28 Print the source C++ array, as well as the ndarray, to check if they are the same::
36 << "Python ndarray :" << p::extract<char const *>(p::str(py_array)) << std::endl;
38 Now, change an element in the Python ndarray, and check if the value changed correspondingly in the…
41 …std::cout << "Is the change reflected in the C++ array used to create the ndarray ? " << std::endl;
47 Next, change an element of the source C++ array and see if it is reflected in the Python ndarray::
51 << "Is the change reflected in the Python ndarray ?" << std::endl
55 …use the from_data method passes the C++ array by reference to create the ndarray, and thus uses th…
Dndarray.rst22 Let's now create an ndarray from a simple tuple. We first create a tuple object, and then pass it t…
25 np::ndarray example_tuple = np::array(tu);
31 np::ndarray example_list = np::array (l);
36 np::ndarray example_list1 = np::array (l,dt);
50 …r of bytes that must be traveled to get to the next desired element while constructing the ndarray.
56 …nction takes the data array, datatype,shape,stride and owner as arguments and returns an ndarray ::
58 np::ndarray data_ex1 = np::from_data(data,dt, shape,stride,own);
60 Now let's print the ndarray we created ::
65 Let's make it a little more interesting. Lets make an 3x2 ndarray from a multi-dimensional array us…
81 Now lets first create and print out the ndarray as is.
[all …]
Ddtype.rst24 np::ndarray a = np::zeros(shape, dtype);
31 … also print the dtypes of the data members of the ndarray by using the get_dtype method for the nd…
51 We are now ready to create an ndarray with dimensions specified by \*shape\* and of custom dtpye ::
53 np::ndarray new_array = np::zeros(shape,custom_dtype);
/third_party/boost/libs/python/doc/html/numpy/_sources/tutorial/
Dfromdata.rst.txt4 One of the advantages of the ndarray wrapper is that the same data can be used in both Python and C…
20 Create an array in C++ , and pass the pointer to it to the from_data method to create an ndarray::
23 np::ndarray py_array = np::from_data(arr, np::dtype::get_builtin<int>(),
28 Print the source C++ array, as well as the ndarray, to check if they are the same::
36 << "Python ndarray :" << p::extract<char const *>(p::str(py_array)) << std::endl;
38 Now, change an element in the Python ndarray, and check if the value changed correspondingly in the…
41 …std::cout << "Is the change reflected in the C++ array used to create the ndarray ? " << std::endl;
47 Next, change an element of the source C++ array and see if it is reflected in the Python ndarray::
51 << "Is the change reflected in the Python ndarray ?" << std::endl
55 …use the from_data method passes the C++ array by reference to create the ndarray, and thus uses th…
Dndarray.rst.txt22 Let's now create an ndarray from a simple tuple. We first create a tuple object, and then pass it t…
25 np::ndarray example_tuple = np::array(tu);
31 np::ndarray example_list = np::array (l);
36 np::ndarray example_list1 = np::array (l,dt);
50 …r of bytes that must be traveled to get to the next desired element while constructing the ndarray.
56 …nction takes the data array, datatype,shape,stride and owner as arguments and returns an ndarray ::
58 np::ndarray data_ex1 = np::from_data(data,dt, shape,stride,own);
60 Now let's print the ndarray we created ::
65 Let's make it a little more interesting. Lets make an 3x2 ndarray from a multi-dimensional array us…
81 Now lets first create and print out the ndarray as is.
[all …]
Ddtype.rst.txt24 np::ndarray a = np::zeros(shape, dtype);
31 … also print the dtypes of the data members of the ndarray by using the get_dtype method for the nd…
51 We are now ready to create an ndarray with dimensions specified by \*shape\* and of custom dtpye ::
53 np::ndarray new_array = np::zeros(shape,custom_dtype);
/third_party/boost/libs/python/example/numpy/
Dgaussian.cpp179 static bn::ndarray py_get_mu(bp::object const & self) { in py_get_mu()
189 static bn::ndarray py_get_sigma(bp::object const & self) { in py_get_sigma()
211 static void copy_ndarray_to_mv2(bn::ndarray const & array, vector2 & vec) { in copy_ndarray_to_mv2()
220 static void copy_ndarray_to_mv2(bn::ndarray const & array, matrix2 & mat) { in copy_ndarray_to_mv2()
255 std::auto_ptr<bn::ndarray> array( in convertible()
256 new bn::ndarray( in convertible()
257 … bn::from_object(obj, bn::dtype::get_builtin<double>(), N, N, bn::ndarray::V_CONTIGUOUS) in convertible()
274 std::auto_ptr<bn::ndarray> array(reinterpret_cast<bn::ndarray*>(data->convertible)); in construct()
Dndarray.cpp32 np::ndarray example_tuple = np::array (tu) ; in main()
35 np::ndarray example_list = np::array (l) ; in main()
38 np::ndarray example_list1 = np::array (l,dt); in main()
48 np::ndarray data_ex = np::from_data(data,dt,shape,stride,own); in main()
62 …np::ndarray mul_data_ex = np::from_data(mul_data,dt1, p::make_tuple(3,4),p::make_tuple(4,1),p::obj… in main()
Dwrap.cpp51 void wrap_fill1(np::ndarray const & array) { in wrap_fill1()
82 void wrap_fill2(np::ndarray const & array) { in wrap_fill2()
91 if (!(array.get_flags() & np::ndarray::C_CONTIGUOUS)) { in wrap_fill2()
/third_party/mindspore/mindspore/explainer/
D_utils.py42 _Array = np.ndarray
91 elif isinstance(inputs, np.ndarray):
217 def format_tensor_to_ndarray(x: Union[ms.Tensor, np.ndarray]) -> np.ndarray: argument
222 if not isinstance(x, np.ndarray):
228 def calc_correlation(x: Union[ms.Tensor, np.ndarray], argument
229 y: Union[ms.Tensor, np.ndarray]) -> float:
/third_party/mindspore/mindspore/dataset/engine/
Dqueue.py79 if not isinstance(data, tuple) and not isinstance(data, np.ndarray):
87 if (isinstance(r, np.ndarray) and r.size > self.min_shared_mem
91 … dest = np.ndarray(r.shape, r.dtype, buffer=self.shm_list[self.seg_pos].get_obj(),
100 if isinstance(r, np.ndarray) and r.size >= self.min_shared_mem:
133 data = np.ndarray(shape, dtype, buffer=b.get_obj(), offset=start_offset)
/third_party/mindspore/mindspore/explainer/explanation/_attribution/_perturbation/
Dablation.py85 def _assign(original_array: np.ndarray, replacement: np.ndarray, masks: np.ndarray): argument
133 saliency: np.ndarray, argument
135 ) -> np.ndarray:
/third_party/mindspore/mindspore/dataset/utils/
Dbrowse_dataset.py75 …assert isinstance(image, np.ndarray) and image.ndim == 3 and (image.shape[0] == 3 or image.shape[2…
78 …assert isinstance(bboxes, np.ndarray) and bboxes.ndim == 2 and (bboxes.shape[1] == 4 or bboxes.sha…
80 assert isinstance(labels, np.ndarray) and labels.ndim == 2 and labels.shape[1] == 1 and \
83 …assert isinstance(segm, np.ndarray) and segm.ndim == 3, "segm must be a ndarray in (M, H, W) forma…

123456