Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.87 KB | None | 0 0
  1. class NatureDQNHead(chainer.ChainList):
  2.     """DQN's head (Nature version)"""
  3.  
  4.     def __init__(self, n_input_channels=4, n_output_channels=512,
  5.                  activation=F.relu, bias=0.1):
  6.         self.n_input_channels = n_input_channels
  7.         self.activation = activation
  8.         self.n_output_channels = n_output_channels
  9.  
  10.         layers = [
  11.             L.Convolution2D(n_input_channels, 32, 8, stride=4,
  12.                             initial_bias=bias),
  13.             L.Convolution2D(32, 64, 4, stride=2, initial_bias=bias),
  14.             L.Convolution2D(64, 64, 3, stride=1, initial_bias=bias),
  15.             L.Linear(3136, n_output_channels, initial_bias=bias),
  16.         ]
  17.  
  18.         super(NatureDQNHead, self).__init__(*layers)
  19.  
  20.     def __call__(self, state):
  21.         h = state
  22.         for layer in self:
  23.             h = self.activation(layer(h))
  24.         return h
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement