def __init__(self, data_dims, nsteps=1, window_size=1, bias=False, linear_map=slim.Linear, nonlin=nn.GELU, hsizes=[64], timedelay=0, input_keys=['Yp'], linargs=dict(), name='RNN_estim'): """ see base class for arguments """ super().__init__(data_dims, nsteps=nsteps, window_size=window_size, input_keys=input_keys, timedelay=timedelay, name=name) self.in_features = self.sequence_dims_sum self.net = blocks.RNN(self.in_features, self.out_features, hsizes=hsizes, bias=bias, nonlin=nonlin, linear_map=linear_map, linargs=linargs)
def __init__(self, data_dims, nsteps=1, bias=False, Linear=slim.Linear, nonlin=nn.GELU, hsizes=[64], input_keys=['x0'], linargs=dict(), name='RNN_policy'): """ See LinearPolicy for arguments """ super().__init__(data_dims, nsteps=nsteps, input_keys=input_keys, name=name) self.in_features = self.sequence_dims_sum + self.static_dims_sum self.net = blocks.RNN(self.in_features, self.out_features, hsizes=hsizes, bias=bias, nonlin=nonlin, Linear=Linear, linargs=linargs)
data = {'x0': x, 'Uf': U, 'Df': D, 'Yf': Y} datadims = {'x0': (nx, ), 'Uf': (N, nu), 'Df': (N, nd), 'Yf': (N, ny)} # block SSM fx, fu, fd = [ blocks.MLP(insize, nx, hsizes=[64, 64, 64]) for insize in [nx, nu, nd] ] fy = blocks.MLP(nx, ny, hsizes=[64, 64, 64]) model = BlockSSM(fx, fy, fu, fd) model = BlockSSM(fx, fy, fu, fd) output = model(data) # black box SSM fxud = blocks.MLP(nx + nu + nd, nx, hsizes=[64, 64, 64]) fy = slim.Linear(nx, ny) model = BlackSSM(fxud, fy) output = model(data) fxud = blocks.RNN(nx + nu + nd, nx, hsizes=[64, 64, 64]) model = BlackSSM(fxud, fy) output = model(data) data = {'x0_new': x, 'Uf': U, 'Df': D, 'Yf_fresh': Y} datadims = { 'x0_new': (nx, ), 'Uf': (N, nu), 'Df': (N, nd), 'Yf_fresh': (N, ny) } # block SSM fx, fu, fd = [ blocks.MLP(insize, nx, hsizes=[64, 64, 64]) for insize in [nx, nu, nd] ] fy = blocks.MLP(nx, ny, hsizes=[64, 64, 64])