Exemplo n.º 1
0
 def init_fromvector(vec, state):
     ""
     vals = []
     var_sizes = state.size()
     i = 0
     for var in state:
         vals.append(np.squeeze(vec[i:(i + var_sizes[var])]))
         i += var_sizes[var]
     return State(zip(state.keys(), vals))
Exemplo n.º 2
0
 def init_fromvector(vec, state):
     ""
     vals = []
     var_sizes = state.size()
     i = 0
     for var in state:
         vals.append(np.squeeze(vec[i:(i+var_sizes[var])]))
         i += var_sizes[var]
     return State(zip(state.keys(), vals))
Exemplo n.º 3
0
    def fromvector(self, vec):
        """ Update the state using a numpy array. 

            :param vec: np.array for updating the state.
        """
        var_sizes = self.size()
        i = 0
        for var in self:
            self[var] = np.squeeze(vec[i:(i + var_sizes[var])])
            i += var_sizes[var]
        return self
Exemplo n.º 4
0
    def fromvector(self, vec):
        """ Update the state using a numpy array. 

            :param vec: np.array for updating the state.
        """
        var_sizes = self.size()
        i = 0
        for var in self:
            self[var] = np.squeeze(vec[i:(i+var_sizes[var])])
            i += var_sizes[var]
        return self