Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, act_dim):
self.conv1 = layers.conv2d(
num_filters=32, filter_size=8, stride=4, padding=1, act='relu')
self.conv2 = layers.conv2d(
num_filters=64, filter_size=4, stride=2, padding=2, act='relu')
self.conv3 = layers.conv2d(
num_filters=64, filter_size=3, stride=1, padding=0, act='relu')
self.fc = layers.fc(size=512, act='relu')
self.policy_fc = layers.fc(size=act_dim)
self.value_fc = layers.fc(size=1)
def __init__(self, act_dim):
self.conv1 = layers.conv2d(
num_filters=32, filter_size=8, stride=4, padding=1, act='relu')
self.conv2 = layers.conv2d(
num_filters=64, filter_size=4, stride=2, padding=2, act='relu')
self.conv3 = layers.conv2d(
num_filters=64, filter_size=3, stride=1, padding=0, act='relu')
self.fc = layers.fc(size=512, act='relu')
self.policy_fc = layers.fc(size=act_dim)
self.value_fc = layers.fc(size=1)
def __init__(self, act_dim):
self.conv1 = layers.conv2d(
num_filters=16, filter_size=4, stride=2, padding=1, act='relu')
self.conv2 = layers.conv2d(
num_filters=32, filter_size=4, stride=2, padding=2, act='relu')
self.conv3 = layers.conv2d(
num_filters=256, filter_size=11, stride=1, padding=0, act='relu')
self.policy_conv = layers.conv2d(
num_filters=act_dim,
filter_size=1,
stride=1,
padding=0,
act=None,
param_attr=ParamAttr(initializer=fluid.initializer.Normal()))
self.value_fc = layers.fc(
size=1,
param_attr=ParamAttr(initializer=fluid.initializer.Normal()))
def __init__(self, act_dim, algo='DQN'):
self.act_dim = act_dim
self.conv1 = layers.conv2d(
num_filters=32, filter_size=5, stride=1, padding=2, act='relu')
self.conv2 = layers.conv2d(
num_filters=32, filter_size=5, stride=1, padding=2, act='relu')
self.conv3 = layers.conv2d(
num_filters=64, filter_size=4, stride=1, padding=1, act='relu')
self.conv4 = layers.conv2d(
num_filters=64, filter_size=3, stride=1, padding=1, act='relu')
self.algo = algo
if algo == 'Dueling':
self.fc1_adv = layers.fc(size=512, act='relu')
self.fc2_adv = layers.fc(size=act_dim)
self.fc1_val = layers.fc(size=512, act='relu')
self.fc2_val = layers.fc(size=1)
else:
self.fc1 = layers.fc(size=act_dim)
def __init__(self, act_dim, algo='DQN'):
self.act_dim = act_dim
self.conv1 = layers.conv2d(
num_filters=32, filter_size=5, stride=1, padding=2, act='relu')
self.conv2 = layers.conv2d(
num_filters=32, filter_size=5, stride=1, padding=2, act='relu')
self.conv3 = layers.conv2d(
num_filters=64, filter_size=4, stride=1, padding=1, act='relu')
self.conv4 = layers.conv2d(
num_filters=64, filter_size=3, stride=1, padding=1, act='relu')
self.algo = algo
if algo == 'Dueling':
self.fc1_adv = layers.fc(size=512, act='relu')
self.fc2_adv = layers.fc(size=act_dim)
self.fc1_val = layers.fc(size=512, act='relu')
self.fc2_val = layers.fc(size=1)
else:
self.fc1 = layers.fc(size=act_dim)
def __init__(self, act_dim, algo='DQN'):
self.act_dim = act_dim
self.conv1 = layers.conv2d(
num_filters=32, filter_size=5, stride=1, padding=2, act='relu')
self.conv2 = layers.conv2d(
num_filters=32, filter_size=5, stride=1, padding=2, act='relu')
self.conv3 = layers.conv2d(
num_filters=64, filter_size=4, stride=1, padding=1, act='relu')
self.conv4 = layers.conv2d(
num_filters=64, filter_size=3, stride=1, padding=1, act='relu')
self.algo = algo
if algo == 'Dueling':
self.fc1_adv = layers.fc(size=512, act='relu')
self.fc2_adv = layers.fc(size=act_dim)
self.fc1_val = layers.fc(size=512, act='relu')
self.fc2_val = layers.fc(size=1)
else:
self.fc1 = layers.fc(size=act_dim)
def __init__(self, multi_conv_layers):
super(CNN,
self).__init__([layers.conv2d(**c) for c in multi_conv_layers])