Paddle
Paddle copied to clipboard
如何创建二维的sparse_binary_vector
是这样的,
sel_wav_binary = paddle.layer.data(
name='select_wav_binary',
type=paddle.data_type.sparse_binary_vector(vocab_size*2+1))
这个值创建了1*(vocab_size2+1)的矩阵, 我想创建高度为N的,总大小为N(vocab_size*2+1)的矩阵该如何操作, 输入的"select_wav_binary"为 [[111000],[111000],[111000]]
高度为N的话,就是batch_size=N,传入N条数据就可以了。
@luotao1 我指的是语音,假设语音有N帧,特征维数是40维,如下:
drop = paddle.layer.dropout(input=rnn_group_output, dropout_rate=0.5)
fc = paddle.layer.fc(
input=drop,
size=dict_size + 1,
act=paddle.activation.Linear(),
bias_attr=True,
layer_attr=paddle.attr.ExtraLayerAttribute(drop_rate=0.5))
fc_wav = paddle.layer.selective_fc(input=fc,select=sel_wav_binary,size=dict_size+1,act=paddle.activation.Linear())
此时的fc应该是N*(dict_size+1),那么select如果设置为[11111...0000]那么高度是1,明显不符合N的高度,那么select应该传入什么样的参数才能解决这个问题呢,一点有效的信息都没有
related #10583