Certainly, we'd want to ensure, or at least evince, through examples that we can do the same algebraic operations, addition, multiplication, and some element-wise Hadamard operations (element-wise addition and multiplication).
In [1]:
import numpy
import numpy as np
In [4]:
m=6
n=4
k=5
In [10]:
a = np.array(range(11,41)).reshape((k,m)).T
In [11]:
print(a)
In [12]:
b = np.array(range(11,31)).reshape((n,k)).T
In [13]:
print(b)
In [14]:
c = np.array(range(11,35)).reshape((n,m)).T
In [15]:
print(c)
In [16]:
np.matmul(a,b)
Out[16]:
In [21]:
np.diag(range(11,15))
Out[21]:
In [18]:
np.ones(m*n)
Out[18]:
In [26]:
# bias_broadcasted
np.matmul( np.ones(m*n).reshape((m,n)) , np.diag(range(11,15)) )
Out[26]:
In [27]:
# a*b + bias_broadcasted
np.matmul(a,b) + np.matmul( np.ones(m*n).reshape((m,n)) , np.diag(range(11,15)) )
Out[27]:
Now compare these results with running cuBlackDream/examples/RModule.cu
; here is a tip for compilation:
nvcc -std=c++14 -arch='sm_52' -lcublas ../src/Axon/Axon.cu ../src/Axon/activationf.cu RModule.cu -o RModule.exe
In [ ]: