Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug report - in matrix-vector multiplication #30

Open
omri123 opened this issue Jun 20, 2019 · 0 comments
Open

bug report - in matrix-vector multiplication #30

omri123 opened this issue Jun 20, 2019 · 0 comments

Comments

@omri123
Copy link

omri123 commented Jun 20, 2019

when multiplying k-by-m (block-sparse) with m-by-n (dense), if n==1, result is vector of zeros.
I am using tf-1.12 with cuda 9.0 and 9.2 installed, I am not sure which one is used.
code:

`
from blocksparse.matmul import BlocksparseMatMul
import tensorflow as tf
import numpy as np

hidden_size = 16
block_size = 8
minibatch_size = 1

sparsity = np.random.randint(2, size=(hidden_size//block_size,hidden_size//block_size))
bsmm = BlocksparseMatMul(sparsity, block_size=block_size, feature_axis=0)

x = tf.placeholder(tf.float32, shape=[hidden_size, None])
w = tf.placeholder(tf.float32, shape=bsmm.w_shape)

x_data = np.ones([hidden_size, minibatch_size], dtype='float32')
a,b,c = bsmm.w_shape
w_data = np.ones(bsmm.w_shape, 'float32')
y = bsmm(x, w)

sess = tf.InteractiveSession()
sess.run(tf.global_variables_initializer())
y_ = sess.run([y], feed_dict={x:x_data, w:w_data})
print(y_[0])
`

@omri123 omri123 changed the title bug report - in matrix-vector multiplication #29 bug report - in matrix-vector multiplication Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant