本文整理匯總了Python中blocks.bricks.conv.MaxPooling.input_dim方法的典型用法代碼示例。如果您正苦於以下問題:Python MaxPooling.input_dim方法的具體用法?Python MaxPooling.input_dim怎麽用?Python MaxPooling.input_dim使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類blocks.bricks.conv.MaxPooling
的用法示例。
在下文中一共展示了MaxPooling.input_dim方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_max_pooling
# 需要導入模塊: from blocks.bricks.conv import MaxPooling [as 別名]
# 或者: from blocks.bricks.conv.MaxPooling import input_dim [as 別名]
def test_max_pooling():
x = tensor.tensor4("x")
num_channels = 4
batch_size = 5
x_size = 17
y_size = 13
pool_size = 3
pool = MaxPooling((pool_size, pool_size))
y = pool.apply(x)
func = function([x], y)
x_val = numpy.ones((batch_size, num_channels, x_size, y_size), dtype=theano.config.floatX)
assert_allclose(func(x_val), numpy.ones((batch_size, num_channels, x_size / pool_size, y_size / pool_size)))
pool.input_dim = (x_size, y_size)
pool.get_dim("output") == (num_channels, x_size / pool_size + 1, y_size / pool_size + 1)