cumo 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +16 -36
- data/3rd_party/mkmf-cu/lib/mkmf-cu/cli.rb +7 -0
- data/CHANGELOG.md +16 -0
- data/Dockerfile +34 -0
- data/cumo.gemspec +1 -1
- data/docker-build.sh +4 -0
- data/docker-launch.sh +4 -0
- data/docs/src-tree.md +1 -1
- data/ext/cumo/cuda/cudnn_impl.cpp +25 -3
- data/ext/cumo/cuda/driver.c +8 -0
- data/ext/cumo/depend.erb +1 -1
- data/ext/cumo/extconf.rb +1 -1
- data/ext/cumo/include/cumo/cuda/cumo_thrust.hpp +13 -6
- data/ext/cumo/include/cumo/cuda/cumo_thrust_complex.hpp +3 -3
- data/ext/cumo/include/cumo/types/complex_macro_kernel.h +15 -4
- data/ext/cumo/include/cumo/types/real_accum_kernel.h +15 -4
- data/ext/cumo/include/cumo/types/xint_macro_kernel.h +11 -3
- data/ext/cumo/include/cumo.h +2 -2
- data/ext/cumo/narray/array.c +5 -3
- data/ext/cumo/narray/data.c +25 -26
- data/ext/cumo/narray/gen/tmpl/accum.c +2 -2
- data/ext/cumo/narray/gen/tmpl/accum_binary.c +1 -1
- data/ext/cumo/narray/gen/tmpl/aref.c +18 -18
- data/ext/cumo/narray/gen/tmpl/aset.c +16 -16
- data/ext/cumo/narray/gen/tmpl/batch_norm.c +4 -1
- data/ext/cumo/narray/gen/tmpl/batch_norm_backward.c +4 -1
- data/ext/cumo/narray/gen/tmpl/bincount.c +7 -7
- data/ext/cumo/narray/gen/tmpl/clip.c +11 -15
- data/ext/cumo/narray/gen/tmpl/cum.c +1 -1
- data/ext/cumo/narray/gen/tmpl/each.c +4 -2
- data/ext/cumo/narray/gen/tmpl/each_with_index.c +5 -2
- data/ext/cumo/narray/gen/tmpl/fixed_batch_norm.c +4 -1
- data/ext/cumo/narray/gen/tmpl/logseq.c +6 -5
- data/ext/cumo/narray/gen/tmpl/map_with_index.c +5 -6
- data/ext/cumo/narray/gen/tmpl/median.c +2 -2
- data/ext/cumo/narray/gen/tmpl/minmax.c +1 -1
- data/ext/cumo/narray/gen/tmpl/poly.c +4 -4
- data/ext/cumo/narray/gen/tmpl/rand.c +8 -6
- data/ext/cumo/narray/gen/tmpl/rand_norm.c +18 -16
- data/ext/cumo/narray/gen/tmpl/seq.c +5 -4
- data/ext/cumo/narray/gen/tmpl/sort.c +2 -2
- data/ext/cumo/narray/gen/tmpl/sort_index.c +2 -2
- data/ext/cumo/narray/gen/tmpl_bit/aref.c +26 -32
- data/ext/cumo/narray/gen/tmpl_bit/aset.c +18 -30
- data/ext/cumo/narray/index.c +1 -1
- data/ext/cumo/narray/narray.c +19 -18
- data/lib/cumo/narray/extra.rb +160 -156
- data/test/cuda/device_test.rb +2 -1
- data/test/cudnn_test.rb +2 -2
- metadata +5 -2
|
@@ -1,41 +1,29 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Array element(s)
|
|
2
|
+
Array element(s) assignment.
|
|
3
3
|
@overload []=(dim0,..,dimL,val)
|
|
4
|
-
@param [Numeric,Range,
|
|
4
|
+
@param [Numeric,Range,Array,Cumo::Bit,Cumo::Int32,Cumo::Int64] dim0,..,dimL Multi-dimensional Index.
|
|
5
5
|
@param [Numeric,Cumo::NArray,etc] val Value(s) to be set to self.
|
|
6
|
-
@return [Numeric] returns val (last argument).
|
|
6
|
+
@return [Numeric] returns `val` (last argument).
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
for each dimention). Broadcasting mechanism is applied.
|
|
8
|
+
Replaces element(s) at `dim0`, `dim1`, ... . Broadcasting mechanism is applied.
|
|
10
9
|
|
|
11
|
-
@
|
|
12
|
-
a = Cumo::DFloat.new(3,4).seq
|
|
13
|
-
=> Cumo::DFloat#shape=[3,4]
|
|
14
|
-
[[0, 1, 2, 3],
|
|
15
|
-
[4, 5, 6, 7],
|
|
16
|
-
[8, 9, 10, 11]]
|
|
17
|
-
|
|
18
|
-
a[1,2]=99
|
|
19
|
-
a
|
|
20
|
-
=> Cumo::DFloat#shape=[3,4]
|
|
21
|
-
[[0, 1, 2, 3],
|
|
22
|
-
[4, 5, 99, 7],
|
|
23
|
-
[8, 9, 10, 11]]
|
|
10
|
+
@see #[]
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
a
|
|
27
|
-
=> Cumo::
|
|
28
|
-
[[0,
|
|
29
|
-
|
|
30
|
-
|
|
12
|
+
@example
|
|
13
|
+
a = Cumo::Bit.new(4,5).fill(0)
|
|
14
|
+
# => Cumo::Bit#shape=[4,5]
|
|
15
|
+
# [[0, 0, 0, 0, 0],
|
|
16
|
+
# [0, 0, 0, 0, 0],
|
|
17
|
+
# [0, 0, 0, 0, 0],
|
|
18
|
+
# [0, 0, 0, 0, 0]]
|
|
31
19
|
|
|
32
|
-
a[1,
|
|
20
|
+
a[(0..-1)%2,(1..-1)%2] = 1
|
|
33
21
|
a
|
|
34
|
-
=> Cumo::
|
|
35
|
-
[[0, 1,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
# => Cumo::Bit#shape=[4,5]
|
|
23
|
+
# [[0, 1, 0, 1, 0],
|
|
24
|
+
# [0, 0, 0, 0, 0],
|
|
25
|
+
# [0, 1, 0, 1, 0],
|
|
26
|
+
# [0, 0, 0, 0, 0]]
|
|
39
27
|
*/
|
|
40
28
|
static VALUE
|
|
41
29
|
<%=c_func(-1)%>(int argc, VALUE *argv, VALUE self)
|
data/ext/cumo/narray/index.c
CHANGED
data/ext/cumo/narray/narray.c
CHANGED
|
@@ -324,19 +324,19 @@ cumo_na_setup(VALUE self, int ndim, size_t *shape)
|
|
|
324
324
|
|
|
325
325
|
@example
|
|
326
326
|
i = Cumo::Int64.new([2,4,3])
|
|
327
|
-
|
|
327
|
+
# => Cumo::Int64#shape=[2,4,3](empty)
|
|
328
328
|
|
|
329
329
|
f = Cumo::DFloat.new(3,4)
|
|
330
|
-
|
|
330
|
+
# => Cumo::DFloat#shape=[3,4](empty)
|
|
331
331
|
|
|
332
332
|
f.fill(2)
|
|
333
|
-
|
|
333
|
+
# => Cumo::DFloat#shape=[3,4]
|
|
334
334
|
# [[2, 2, 2, 2],
|
|
335
335
|
# [2, 2, 2, 2],
|
|
336
336
|
# [2, 2, 2, 2]]
|
|
337
337
|
|
|
338
338
|
x = Cumo::NArray.new(5)
|
|
339
|
-
|
|
339
|
+
# => in `new': allocator undefined for Cumo::NArray (TypeError)
|
|
340
340
|
# from t.rb:9:in `<main>'
|
|
341
341
|
|
|
342
342
|
*/
|
|
@@ -420,10 +420,10 @@ cumo_na_initialize_copy(VALUE self, VALUE orig)
|
|
|
420
420
|
* but for typed NArray subclasses, e.g., DFloat, Int64.
|
|
421
421
|
* @example
|
|
422
422
|
* a = Cumo::DFloat.zeros(3,5)
|
|
423
|
-
* => Cumo::DFloat#shape=[3,5]
|
|
424
|
-
* [[0, 0, 0, 0, 0],
|
|
425
|
-
*
|
|
426
|
-
*
|
|
423
|
+
* # => Cumo::DFloat#shape=[3,5]
|
|
424
|
+
* # [[0, 0, 0, 0, 0],
|
|
425
|
+
* # [0, 0, 0, 0, 0],
|
|
426
|
+
* # [0, 0, 0, 0, 0]]
|
|
427
427
|
*/
|
|
428
428
|
static VALUE
|
|
429
429
|
cumo_na_s_zeros(int argc, VALUE *argv, VALUE klass)
|
|
@@ -471,8 +471,8 @@ cumo_na_s_ones(int argc, VALUE *argv, VALUE klass)
|
|
|
471
471
|
|
|
472
472
|
@example
|
|
473
473
|
a = Cumo::DFloat.linspace(-5,5,7)
|
|
474
|
-
=> Cumo::DFloat#shape=[7]
|
|
475
|
-
[-5, -3.33333, -1.66667, 0, 1.66667, 3.33333, 5]
|
|
474
|
+
# => Cumo::DFloat#shape=[7]
|
|
475
|
+
# [-5, -3.33333, -1.66667, 0, 1.66667, 3.33333, 5]
|
|
476
476
|
*/
|
|
477
477
|
static VALUE
|
|
478
478
|
cumo_na_s_linspace(int argc, VALUE *argv, VALUE klass)
|
|
@@ -510,11 +510,12 @@ cumo_na_s_linspace(int argc, VALUE *argv, VALUE klass)
|
|
|
510
510
|
|
|
511
511
|
@example
|
|
512
512
|
Cumo::DFloat.logspace(4,0,5,2)
|
|
513
|
-
=> Cumo::DFloat#shape=[5]
|
|
514
|
-
|
|
513
|
+
# => Cumo::DFloat#shape=[5]
|
|
514
|
+
# [16, 8, 4, 2, 1]
|
|
515
|
+
|
|
515
516
|
Cumo::DComplex.logspace(0,1i*Math::PI,5,Math::E)
|
|
516
|
-
=> Cumo::DComplex#shape=[5]
|
|
517
|
-
|
|
517
|
+
# => Cumo::DComplex#shape=[5]
|
|
518
|
+
# [1+4.44659e-323i, 0.707107+0.707107i, 6.12323e-17+1i, -0.707107+0.707107i, ...]
|
|
518
519
|
*/
|
|
519
520
|
static VALUE
|
|
520
521
|
cumo_na_s_logspace(int argc, VALUE *argv, VALUE klass)
|
|
@@ -548,10 +549,10 @@ cumo_na_s_logspace(int argc, VALUE *argv, VALUE klass)
|
|
|
548
549
|
@return [Cumo::NArray] created NArray.
|
|
549
550
|
@example
|
|
550
551
|
a = Cumo::DFloat.eye(3)
|
|
551
|
-
=> Cumo::DFloat#shape=[3,3]
|
|
552
|
-
[[1, 0, 0],
|
|
553
|
-
|
|
554
|
-
|
|
552
|
+
# => Cumo::DFloat#shape=[3,3]
|
|
553
|
+
# [[1, 0, 0],
|
|
554
|
+
# [0, 1, 0],
|
|
555
|
+
# [0, 0, 1]]
|
|
555
556
|
*/
|
|
556
557
|
static VALUE
|
|
557
558
|
cumo_na_s_eye(int argc, VALUE *argv, VALUE klass)
|