本文整理汇总了Python中tensorflow.nn.relu方法的典型用法代码示例。如果您正苦于以下问题:Python nn.relu方法的具体用法?Python nn.relu怎么用?Python nn.relu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow.nn
的用法示例。
在下文中一共展示了nn.relu方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from tensorflow import nn [as 别名]
# 或者: from tensorflow.nn import relu [as 别名]
def __init__(self, hidden_units=(256,), batch_size=64,
keep_prob=1.0, activation=nn.relu):
super(MLPClassifierManyEpochs, self).__init__(
hidden_units=hidden_units, batch_size=batch_size,
n_epochs=100, keep_prob=keep_prob,
activation=activation,
random_state=42)
示例2: __init__
# 需要导入模块: from tensorflow import nn [as 别名]
# 或者: from tensorflow.nn import relu [as 别名]
def __init__(self, hidden_units=(256,), batch_size=64, n_epochs=5,
keep_prob=1.0, activation=nn.relu,
random_state=None):
super(MLPRegressorFewerParams, self).__init__(
hidden_units=hidden_units, batch_size=batch_size,
n_epochs=n_epochs, keep_prob=keep_prob,
activation=activation,
random_state=random_state)
示例3: fractal_conv2d
# 需要导入模块: from tensorflow import nn [as 别名]
# 或者: from tensorflow.nn import relu [as 别名]
def fractal_conv2d(inputs,
num_columns,
num_outputs,
kernel_size,
joined=True,
stride=1,
padding='SAME',
# rate=1,
activation_fn=nn.relu,
normalizer_fn=slim.batch_norm,
normalizer_params=None,
weights_initializer=initializers.xavier_initializer(),
weights_regularizer=None,
biases_initializer=None,
biases_regularizer=None,
reuse=None,
variables_collections=None,
outputs_collections=None,
is_training=True,
trainable=True,
scope=None):
"""Builds a fractal block with slim.conv2d.
The fractal will have `num_columns` columns, and have
Args:
inputs: a 4-D tensor `[batch_size, height, width, channels]`.
num_columns: integer, the columns in the fractal.
"""
locs = locals()
fractal_args = ['inputs','num_columns','joined','is_training']
asc_fn = lambda : slim.arg_scope([slim.conv2d],
**{arg:val for (arg,val) in locs.items()
if arg not in fractal_args})
return fractal_template(inputs, num_columns, slim.conv2d, asc_fn,
joined, is_training, reuse, scope)