zha guo
zha guo

Reputation: 13

About feed sparse matrix into the graph

For the data dimension is too large, i have to change the data into sparse matrix, instead of the dense array.

However, for the graph includes the cnn, and when i feed the sparse matrix directly, i was told the cnn cannot receive the sparse tensor. so i have to do the operation 'sparse to dense' at first.

But the question is that the data(multi sparse matrix) i feed should be converted to a two-dimension sparse matrix.(e.g i have sparse matrix1, dim is [14,25500],and sparse matrix2, dim is [14,25500], the perfect dimension i want to feed is [2,14,25500], but the reality i faced is [28,25500]) So i have to split the tensor after entering the graph.

i want to ask, if any other ways can solve this problem ?

Upvotes: 0

Views: 68

Answers (1)

prometeu
prometeu

Reputation: 689

tf.stack is your friend

tf.stack([matrix1, matrix2]) # => [2,14,25500]

Upvotes: 0

Related Questions