Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.
This repository was archived by the owner on May 29, 2026. It is now read-only.

bug report - in matrix-vector multiplication #30

Open

Description

@omri123

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])
`

Activity

  1. changed the title [-]bug report - in matrix-vector multiplication #29[/-] [+]bug report - in matrix-vector multiplication[/+] on Jun 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions