def __init__(self, max_num_leaves, in_dim, use_noisylayers): super(DuelingHead, self).__init__() self._max_num_leaves = max_num_leaves if use_noisylayers: self._V_out = NoisyLinear(in_dim, 1) self._A_out = NoisyLinear(in_dim, 1) else: self._V_out = nn.Linear(in_dim, 1) self._A_out = nn.Linear(in_dim, 1)
def __init__(self, max_num_leaves, in_dim, use_noisylayers, num_atoms): super(DuelingC51Head, self).__init__() self._max_num_leaves = max_num_leaves self._num_atoms if use_noisylayers: self._V_out = NoisyLinear(in_dim, 1 * self._num_atoms) self._A_out = NoisyLinear(in_dim, 1 * self._num_atoms) else: self._V_out = nn.Linear(in_dim, self._num_atoms) self._A_out = nn.Linear(in_dim, self._num_atoms)
def __init__(self, max_num_leaves, max_num_goal_tokens, dom_stream_dim, use_noisylayers): super(Head, self).__init__() self._max_num_leaves = max_num_leaves self._max_num_goal_tokens = max_num_goal_tokens mode_stream_dim, token_stream_dim = int(dom_stream_dim / 4), int( dom_stream_dim / 2) if use_noisylayers: self._out_dom = NoisyLinear(dom_stream_dim, 1) self._out_mode = NoisyLinear(mode_stream_dim, 2) self._out_token = NoisyLinear(token_stream_dim, 1) else: self._out_dom = nn.Linear(dom_stream_dim, 1) self._out_mode = nn.Linear(mode_stream_dim, 2) self._out_token = nn.Linear(token_stream_dim, 1)
def __init__(self, in_dom_global_dim, max_num_leaves, max_num_goal_tokens, in_dom_dim, in_token_dim, h_dom_dim, use_noisylayers, use_local, use_neighbor, use_global): super(Body, self).__init__() assert use_local or use_neighbor self._use_local = use_local self._use_neighbor = use_neighbor self._use_global = use_global if not use_global: if use_local and use_neighbor: self._in_cat_dom_dim = in_dom_dim * 2 else: self._in_cat_dom_dim = in_dom_dim else: if use_local and use_neighbor: self._in_cat_dom_dim = in_dom_dim * 2 + in_dom_global_dim else: self._in_cat_dom_dim = in_dom_dim + in_dom_global_dim self._in_mode_dim = in_dom_global_dim self._in_token_dim = in_token_dim self._max_num_leaves = max_num_leaves self._max_num_goal_tokens = max_num_goal_tokens h_mode_dim, h_token_dim = int(h_dom_dim / 4), int(h_dom_dim / 2) if use_noisylayers: self._fc1_dom = NoisyLinear(self._in_cat_dom_dim, h_dom_dim) self._fc2_dom = NoisyLinear(h_dom_dim, h_dom_dim) self._fc1_mode = NoisyLinear(self._in_mode_dim, h_mode_dim) self._fc2_mode = NoisyLinear(h_mode_dim, h_mode_dim) self._fc1_token = NoisyLinear(self._in_token_dim, h_token_dim) self._fc2_token = NoisyLinear(h_token_dim, h_token_dim) else: pass