Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
07ef518b
Commit
07ef518b
authored
May 11, 2016
by
Wenzel Jakob
Browse files
Merge pull request #194 from jmabille/numpy_ctor
add extra constructors in numpy.h
parents
c209323c
a63d93ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
0 deletions
+2
-0
include/pybind11/common.h
include/pybind11/common.h
+1
-0
include/pybind11/numpy.h
include/pybind11/numpy.h
+1
-0
No files found.
include/pybind11/common.h
View file @
07ef518b
...
...
@@ -201,6 +201,7 @@ struct buffer_info {
std
::
vector
<
size_t
>
shape
;
// Shape of the tensor (1 entry per dimension)
std
::
vector
<
size_t
>
strides
;
// Number of entries between adjacent entries (for each per dimension)
buffer_info
()
:
ptr
(
nullptr
),
view
(
nullptr
)
{}
buffer_info
(
void
*
ptr
,
size_t
itemsize
,
const
std
::
string
&
format
,
int
ndim
,
const
std
::
vector
<
size_t
>
&
shape
,
const
std
::
vector
<
size_t
>
&
strides
)
:
ptr
(
ptr
),
itemsize
(
itemsize
),
size
(
1
),
format
(
format
),
...
...
include/pybind11/numpy.h
View file @
07ef518b
...
...
@@ -128,6 +128,7 @@ template <typename T, int ExtraFlags = 0> class array_t : public array {
public:
PYBIND11_OBJECT_CVT
(
array_t
,
array
,
is_non_null
,
m_ptr
=
ensure
(
m_ptr
));
array_t
()
:
array
()
{
}
array_t
(
const
buffer_info
&
info
)
:
array
(
info
)
{}
static
bool
is_non_null
(
PyObject
*
ptr
)
{
return
ptr
!=
nullptr
;
}
static
PyObject
*
ensure
(
PyObject
*
ptr
)
{
if
(
ptr
==
nullptr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment