[python-arrayfire] 176/250: Using as_type instead of af.cast in examples
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:46 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.
commit d62e8382be90dcbef2b55695e0c50c24279d2d53
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Thu Dec 10 13:39:46 2015 -0500
Using as_type instead of af.cast in examples
---
examples/graphics/conway.py | 6 +++---
examples/graphics/fractal.py | 2 +-
examples/graphics/histogram.py | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/examples/graphics/conway.py b/examples/graphics/conway.py
index 9f5d329..f4d515c 100644
--- a/examples/graphics/conway.py
+++ b/examples/graphics/conway.py
@@ -38,7 +38,7 @@ frame_count = 0
kernel = af.Array(h_kernel, dims=(3,3))
# Generate the initial state with 0s and 1s
-state = af.cast(af.randu(game_h, game_w) > 0.4, af.Dtype.f32)
+state = (af.randu(game_h, game_w) > 0.4).as_type(af.Dtype.f32)
# tile 3 times to display color
display = af.tile(state, 1, 1, 3, 1)
@@ -50,7 +50,7 @@ while (not simple_win.close()) and (not pretty_win.close()):
frame_count += 1
if (frame_count % reset == 0):
- state = af.cast(af.randu(game_h, game_w) > 0.4, af.Dtype.f32)
+ state = (af.randu(game_h, game_w) > 0.4).as_type(af.Dtype.f32)
neighborhood = af.convolve(state, kernel)
@@ -66,7 +66,7 @@ while (not simple_win.close()) and (not pretty_win.close()):
A2 = (state == 0) & C1
A3 = (state == 1) & (neighborhood > 3)
- display = af.cast(af.join(2, A0 + A1, A1 + A2, A3), af.Dtype.f32)
+ display = (af.join(2, A0 + A1, A1 + A2, A3).as_type(af.Dtype.f32)
state = state * C0 + C1
diff --git a/examples/graphics/fractal.py b/examples/graphics/fractal.py
index eed8fea..37b35a6 100644
--- a/examples/graphics/fractal.py
+++ b/examples/graphics/fractal.py
@@ -31,7 +31,7 @@ def mandelbrot(data, it, maxval):
Z = Z * Z + C
# Get indices where abs(Z) crosses maxval
- cond = af.cast((af.abs(Z) > maxval), af.Dtype.f32)
+ cond = ((af.abs(Z) > maxval)).as_type(af.Dtype.f32)
mag = af.maxof(mag, cond * ii)
C = C * (1 - cond)
diff --git a/examples/graphics/histogram.py b/examples/graphics/histogram.py
index 6f5768b..3a3d29a 100644
--- a/examples/graphics/histogram.py
+++ b/examples/graphics/histogram.py
@@ -29,7 +29,7 @@ if __name__ == "__main__":
hist_win = af.Window(512, 512, "3D Plot example using ArrayFire")
img_win = af.Window(480, 640, "Input Image")
- img = af.cast(af.load_image(sys.argv[1]), af.Dtype.u8)
+ img = (af.load_image(sys.argv[1])).(af.Dtype.u8)
hist = af.histogram(img, 256, 0, 255)
while (not hist_win.close()) and (not img_win.close()):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git
More information about the debian-science-commits
mailing list