本文整理汇总了Python中pylearn2.sandbox.cuda_convnet.filter_acts.FilterActs.eval方法的典型用法代码示例。如果您正苦于以下问题:Python FilterActs.eval方法的具体用法?Python FilterActs.eval怎么用?Python FilterActs.eval使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pylearn2.sandbox.cuda_convnet.filter_acts.FilterActs
的用法示例。
在下文中一共展示了FilterActs.eval方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_funcs
# 需要导入模块: from pylearn2.sandbox.cuda_convnet.filter_acts import FilterActs [as 别名]
# 或者: from pylearn2.sandbox.cuda_convnet.filter_acts.FilterActs import eval [as 别名]
def make_funcs(batch_size, rows, cols, channels, filter_rows, num_filters):
rng = np.random.RandomState([2012, 10, 9])
filter_cols = filter_rows
base_image_value = rng.uniform(-1.0, 1.0, (channels, rows, cols, batch_size)).astype("float32")
base_filters_value = rng.uniform(-1.0, 1.0, (channels, filter_rows, filter_cols, num_filters)).astype("float32")
images = shared(base_image_value)
filters = shared(base_filters_value, name="filters")
# bench.py should always be run in gpu mode so we should not need a gpu_from_host here
output = FilterActs()(images, filters)
output_shared = shared(output.eval())
cuda_convnet = function([], updates={output_shared: output})
cuda_convnet.name = "cuda_convnet"
images_bc01v = base_image_value.transpose(3, 0, 1, 2)
filters_bc01v = base_filters_value.transpose(3, 0, 1, 2)
filters_bc01v = filters_bc01v[:, :, ::-1, ::-1]
images_bc01 = shared(images_bc01v)
filters_bc01 = shared(filters_bc01v)
output_conv2d = conv2d(
images_bc01, filters_bc01, border_mode="valid", image_shape=images_bc01v.shape, filter_shape=filters_bc01v.shape
)
output_conv2d_shared = shared(output_conv2d.eval())
baseline = function([], updates={output_conv2d_shared: output_conv2d})
baseline.name = "baseline"
return cuda_convnet, baseline