(self, obs)
return output, pol_sigma, pol_prec, pol_det_sigma
Run policy forward.
        Args:
            obs: Numpy array of observations that is N x T x dO.
Run policy forward.
        Args:
            obs: Numpy array of observations that is N x T x dO.
Run policy forward . Args : obs : Numpy array of observations that is N x T x dO .
def prob(self, obs):
        """
        Run policy forward.
        Args:
            obs: Numpy array of observations that is N x T x dO.
        """
        dU = self._dU
        N, T = obs.shape[:2]

        # Normalize obs.
        if self.policy.scale is not None:
            # TODO: Should prob be called before update?
            for n in range(N):
                obs[n, :, :] = obs[n, :, :].dot(self.policy.scale) + \
                        self.policy.bias

        output = np.zeros((N, T, dU))
        blob_names = self.solver.test_nets[0].blobs.keys()

        self.solver.test_nets[0].share_with(self.solver.net)

        for i in range(N):
            for t in range(T):
                # Feed in data.
                self.solver.test_nets[0].blobs[blob_names[0]].data[:] = \
                        obs[i, t]

                # Assume that the first output blob is what we want.
                output[i, t, :] = \
                        self.solver.test_nets[0].forward().values()[0][0]

        pol_sigma = np.tile(np.diag(self.var), [N, T, 1, 1])
        pol_prec = np.tile(np.diag(1.0 / self.var), [N, T, 1, 1])
        pol_det_sigma = np.tile(np.prod(self.var), [N, T])

        return output, pol_sigma, pol_prec, pol_det_sigma
def prob ( self , obs ) : dU = self . _dU N , T = obs . shape [ : 2 ] # Normalize obs. if self . policy . scale is not None : # TODO: Should prob be called before update? for n in range ( N ) : obs [ n , : , : ] = obs [ n , : , : ] . dot ( self . policy . scale ) + self . policy . bias output = np . zeros ( ( N , T , dU ) ) blob_names = self . solver . test_nets [ 0 ] . blobs . keys ( ) self . solver . test_nets [ 0 ] . share_with ( self . solver . net ) for i in range ( N ) : for t in range ( T ) : # Feed in data. self . solver . test_nets [ 0 ] . blobs [ blob_names [ 0 ] ] . data [ : ] = obs [ i , t ] # Assume that the first output blob is what we want. output [ i , t , : ] = self . solver . test_nets [ 0 ] . forward ( ) . values ( ) [ 0 ] [ 0 ] pol_sigma = np . tile ( np . diag ( self . var ) , [ N , T , 1 , 1 ] ) pol_prec = np . tile ( np . diag ( 1.0 / self . var ) , [ N , T , 1 , 1 ] ) pol_det_sigma = np . tile ( np . prod ( self . var ) , [ N , T ] ) return output , pol_sigma , pol_prec , pol_det_sigma