Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pystencils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pycodegen
pystencils
Merge requests
!125
Fix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Fix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}
seitz/pystencils:fix-arrayhandlers
into
master
Overview
0
Commits
1
Pipelines
1
Changes
2
Merged
Fix {PyCuda,PyOpenCl}ArrayHandler.{zeros,ones,randn}
Stephan Seitz
requested to merge
seitz/pystencils:fix-arrayhandlers
into
master
Jan 15, 2020
Overview
0
Commits
1
Pipelines
1
Changes
2
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
4dcc3ea5
1 commit,
Jan 15, 2020
2 files
+
6
−
2
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
pystencils/datahandling/pycuda.py
+
4
−
2
View file @ 4dcc3ea5
Edit in single-file editor
Open in Web IDE
Show full file
@@ -21,7 +21,7 @@ class PyCudaArrayHandler:
def
empty
(
self
,
shape
,
dtype
=
np
.
float64
,
layout
=
None
):
if
layout
:
cpu_array
=
pystencils
.
field
.
create_numpy_array_with_layout
(
shape
,
dtype
,
layout
)
return
self
.
from_numpy
(
cpu_array
)
return
self
.
to_gpu
(
cpu_array
)
else
:
return
gpuarray
.
empty
(
shape
,
dtype
)
@@ -36,4 +36,6 @@ class PyCudaArrayHandler:
def
randn
(
self
,
shape
,
dtype
=
np
.
float64
):
cpu_array
=
np
.
random
.
randn
(
*
shape
).
astype
(
dtype
)
return
self
.
from_numpy
(
cpu_array
)
return
self
.
to_gpu
(
cpu_array
)
from_numpy
=
to_gpu
Loading