'Creates ops that read submatrix shards from disk.'

def _count_matrix_input(self, filenames, submatrix_rows, submatrix_cols):

    random.shuffle(filenames)
    filename_queue = tf.train.string_input_producer(filenames)
    reader = tf.WholeFileReader()
    (_, serialized_example) = reader.read(filename_queue)
    features = tf.parse_single_example(serialized_example, features={'global_row': tf.FixedLenFeature([submatrix_rows], dtype=tf.int64), 'global_col': tf.FixedLenFeature([submatrix_cols], dtype=tf.int64), 'sparse_local_row': tf.VarLenFeature(dtype=tf.int64), 'sparse_local_col': tf.VarLenFeature(dtype=tf.int64), 'sparse_value': tf.VarLenFeature(dtype=tf.float32)})
    global_row = features['global_row']
    global_col = features['global_col']
    sparse_local_row = features['sparse_local_row'].values
    sparse_local_col = features['sparse_local_col'].values
    sparse_count = features['sparse_value'].values
    sparse_indices = tf.concat(axis=1, values=[tf.expand_dims(sparse_local_row, 1), tf.expand_dims(sparse_local_col, 1)])
    count = tf.sparse_to_dense(sparse_indices, [submatrix_rows, submatrix_cols], sparse_count)
    return (global_row, global_col, count)
