forked from arrayfire/arrayfire-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimple_data.py
More file actions
executable file
·63 lines (45 loc) · 1.49 KB
/
Copy pathsimple_data.py
File metadata and controls
executable file
·63 lines (45 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/python
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################
import arrayfire as af
af.display(af.constant(100, 3,3, dtype=af.f32))
af.display(af.constant(25, 3,3, dtype=af.c32))
af.display(af.constant(2**50, 3,3, dtype=af.s64))
af.display(af.constant(2+3j, 3,3))
af.display(af.constant(3+5j, 3,3, dtype=af.c32))
af.display(af.range(3, 3))
af.display(af.iota(3, 3, tile_dims=(2,2)))
af.display(af.randu(3, 3, 1, 2))
af.display(af.randu(3, 3, 1, 2, af.b8))
af.display(af.randu(3, 3, dtype=af.c32))
af.display(af.randn(3, 3, 1, 2))
af.display(af.randn(3, 3, dtype=af.c32))
af.set_seed(1024)
assert(af.get_seed() == 1024)
af.display(af.identity(3, 3, 1, 2, af.b8))
af.display(af.identity(3, 3, dtype=af.c32))
a = af.randu(3, 4)
b = af.diag(a, extract=True)
c = af.diag(a, 1, extract=True)
af.display(a)
af.display(b)
af.display(c)
af.display(af.diag(b, extract = False))
af.display(af.diag(c, 1, extract = False))
af.display(af.tile(a, 2, 2))
af.display(af.reorder(a, 1, 0))
af.display(af.shift(a, -1, 1))
af.display(af.moddims(a, 6, 2))
af.display(af.flat(a))
af.display(af.flip(a, 0))
af.display(af.flip(a, 1))
af.display(af.lower(a, False))
af.display(af.lower(a, True))
af.display(af.upper(a, False))
af.display(af.upper(a, True))