Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyopencl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
pyopencl
Commits
9207aaec
Commit
9207aaec
authored
12 years ago
by
Andreas Klöckner
Browse files
Options
Downloads
Patches
Plain Diff
Remove Array.base. Fix strides in Array.view.
parent
64260453
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/source/array.rst
+1
-1
1 addition, 1 deletion
doc/source/array.rst
pyopencl/array.py
+11
-12
11 additions, 12 deletions
pyopencl/array.py
with
12 additions
and
13 deletions
doc/source/array.rst
+
1
−
1
View file @
9207aaec
...
@@ -258,7 +258,7 @@ Constructing :class:`Array` Instances
...
@@ -258,7 +258,7 @@ Constructing :class:`Array` Instances
.. versionchanged:: 2011.1
.. versionchanged:: 2011.1
*context* argument was deprecated.
*context* argument was deprecated.
.. function:: empty(queue, shape, dtype, order="C", allocator=None,
base=None,
data=None)
.. function:: empty(queue, shape, dtype, order="C", allocator=None, data=None)
A synonym for the :class:`Array` constructor.
A synonym for the :class:`Array` constructor.
...
...
This diff is collapsed.
Click to expand it.
pyopencl/array.py
+
11
−
12
View file @
9207aaec
...
@@ -216,7 +216,7 @@ class Array(object):
...
@@ -216,7 +216,7 @@ class Array(object):
"""
"""
def
__init__
(
self
,
cqa
,
shape
,
dtype
,
order
=
"
C
"
,
allocator
=
None
,
def
__init__
(
self
,
cqa
,
shape
,
dtype
,
order
=
"
C
"
,
allocator
=
None
,
base
=
None
,
data
=
None
,
queue
=
None
,
strides
=
None
):
data
=
None
,
queue
=
None
,
strides
=
None
):
# {{{ backward compatibility for pre-cqa days
# {{{ backward compatibility for pre-cqa days
if
isinstance
(
cqa
,
cl
.
CommandQueue
):
if
isinstance
(
cqa
,
cl
.
CommandQueue
):
...
@@ -305,8 +305,6 @@ class Array(object):
...
@@ -305,8 +305,6 @@ class Array(object):
else
:
else
:
self
.
data
=
data
self
.
data
=
data
self
.
base
=
base
@property
@property
def
context
(
self
):
def
context
(
self
):
return
self
.
data
.
context
return
self
.
data
.
context
...
@@ -322,8 +320,7 @@ class Array(object):
...
@@ -322,8 +320,7 @@ class Array(object):
warn
(
"
Array.mem_size is deprecated. Use Array.size
"
,
warn
(
"
Array.mem_size is deprecated. Use Array.size
"
,
DeprecationWarning
,
stacklevel
=
2
)
DeprecationWarning
,
stacklevel
=
2
)
def
_new_with_changes
(
self
,
data
,
shape
=
None
,
dtype
=
None
,
strides
=
None
,
queue
=
None
,
def
_new_with_changes
(
self
,
data
,
shape
=
None
,
dtype
=
None
,
strides
=
None
,
queue
=
None
):
base
=
None
):
if
shape
is
None
:
if
shape
is
None
:
shape
=
self
.
shape
shape
=
self
.
shape
if
dtype
is
None
:
if
dtype
is
None
:
...
@@ -332,17 +329,15 @@ class Array(object):
...
@@ -332,17 +329,15 @@ class Array(object):
strides
=
self
.
strides
strides
=
self
.
strides
if
queue
is
None
:
if
queue
is
None
:
queue
=
self
.
queue
queue
=
self
.
queue
if
base
is
None
and
data
is
self
.
data
:
base
=
self
if
queue
is
not
None
:
if
queue
is
not
None
:
return
Array
(
queue
,
shape
,
dtype
,
return
Array
(
queue
,
shape
,
dtype
,
allocator
=
self
.
allocator
,
strides
=
strides
,
base
=
base
)
allocator
=
self
.
allocator
,
strides
=
strides
,
data
=
data
)
elif
self
.
allocator
is
not
None
:
elif
self
.
allocator
is
not
None
:
return
Array
(
self
.
allocator
,
shape
,
dtype
,
queue
=
queue
,
return
Array
(
self
.
allocator
,
shape
,
dtype
,
queue
=
queue
,
strides
=
strides
,
base
=
base
)
strides
=
strides
,
data
=
data
)
else
:
else
:
return
Array
(
self
.
context
,
shape
,
dtype
,
strides
=
strides
,
base
=
base
)
return
Array
(
self
.
context
,
shape
,
dtype
,
strides
=
strides
,
data
=
data
)
#@memoize_method FIXME: reenable
#@memoize_method FIXME: reenable
def
get_sizes
(
self
,
queue
,
kernel_specific_max_wg_size
=
None
):
def
get_sizes
(
self
,
queue
,
kernel_specific_max_wg_size
=
None
):
...
@@ -831,8 +826,12 @@ class Array(object):
...
@@ -831,8 +826,12 @@ class Array(object):
raise
ValueError
(
"
new type not compatible with array
"
)
raise
ValueError
(
"
new type not compatible with array
"
)
shape
=
self
.
shape
[:
-
1
]
+
(
self
.
shape
[
-
1
]
*
old_itemsize
//
itemsize
,)
shape
=
self
.
shape
[:
-
1
]
+
(
self
.
shape
[
-
1
]
*
old_itemsize
//
itemsize
,)
strides
=
tuple
(
s
*
itemsize
//
old_itemsize
for
s
in
self
.
strides
)
return
self
.
_new_with_changes
(
data
=
self
.
data
,
shape
=
shape
,
dtype
=
dtype
)
return
self
.
_new_with_changes
(
data
=
self
.
data
,
shape
=
shape
,
dtype
=
dtype
,
strides
=
strides
)
# }}
# }}
...
@@ -849,7 +848,7 @@ def as_strided(ary, shape=None, strides=None):
...
@@ -849,7 +848,7 @@ def as_strided(ary, shape=None, strides=None):
strides
=
strides
or
ary
.
strides
strides
=
strides
or
ary
.
strides
return
Array
(
ary
.
queue
,
shape
,
ary
.
dtype
,
allocator
=
ary
.
allocator
,
return
Array
(
ary
.
queue
,
shape
,
ary
.
dtype
,
allocator
=
ary
.
allocator
,
base
=
ary
.
base
,
data
=
ary
.
data
,
strides
=
strides
)
data
=
ary
.
data
,
strides
=
strides
)
# }}}
# }}}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment