What is num_outputs equivalent for tensorflow.contrib.layers.convolution2d for Theano? -
in tensorflow-contrib, 2d convolution defined in terms of filter_size , num_outputs. how control num_outputs in theano's nnet.conv2d type?
short answer: has determined @ runtime, shape of filters tensor.
unlike tf, theano don't store explicit shape information in tensors.
in tf, can do:
w = tf.placeholder('float32', [64,64], name='w') in theano, there's no way tell x 64 x 64 matrix @ compile time. best can is:
w = t.matrix(name='w', dtype='float32') at compile time, theano knows tensor rank, , dimensions broadcastable.
at runtime, shape of tensors known. if images batch 4d tensor of shape [n, c, h, w], , filters of size [d, c, u, v]. num_outputs inferred d.
edit can specify filter_shape argument in theano.tensor.nnet.conv2d, provides hint theano choose optimal algorithm convolution. shape mismatch error still has determined @ runtime.
Comments
Post a Comment