misc
Home for functions/classes that haven't find a home of their own
t_hstack = partial(torch.cat, dim=-1)
module-attribute
Similar to np.hstack
t_vstack = partial(torch.cat, dim=-2)
module-attribute
Similar to np.vstack
BayesianDynamicsModel
Bases: DynamicsModel
Source code in bayes_cbf/misc.py
187 188 189 190 191 192 |
|
fu_func_gp(U)
abstractmethod
return a GaussianProcessBase
Source code in bayes_cbf/misc.py
188 189 190 191 192 |
|
DynamicsModel
Bases: ABC
Represents mode of the form:
ẋ = f(x) + g(x)u
Source code in bayes_cbf/misc.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
ctrl_size()
property
abstractmethod
Dimension of ctrl
Source code in bayes_cbf/misc.py
118 119 120 121 122 123 |
|
f_func(X)
abstractmethod
ẋ = f(x) + g(x)u
@param: X : d x self.state_size vector or self.state_size vector @returns: f(X)
Source code in bayes_cbf/misc.py
132 133 134 135 136 137 138 139 |
|
g_func(X)
abstractmethod
ẋ = f(x) + g(x)u
@param: X : d x self.state_size vector or self.state_size vector @returns: g(X)
Source code in bayes_cbf/misc.py
141 142 143 144 145 146 147 148 |
|
state_size()
property
abstractmethod
Dimension of state
Source code in bayes_cbf/misc.py
125 126 127 128 129 130 |
|
plot_to_image(figure)
Converts the matplotlib plot specified by 'figure' to a PNG image and returns it. The supplied figure is closed and inaccessible after this call.
Source code in bayes_cbf/misc.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
|
t_hessian(f, x, xp, grad_check=True)
Computes second derivative, Hessian
Source code in bayes_cbf/misc.py
236 237 238 239 240 241 242 243 244 245 |
|
torch_kron(A, B, batch_dims=1)
B = torch.rand(5,3,3) A = torch.rand(5,2,2) AB = torch_kron(A, B) torch.allclose(AB[1, :3, :3] , A[1, 0,0] * B[1, ...]) True BA = torch_kron(B, A) torch.allclose(BA[1, :2, :2] , B[1, 0,0] * A[1, ...]) True B = torch.rand(3,2) A = torch.rand(2,3) AB = torch_kron(A, B, batch_dims=0) AB.shape = (6, 6) True
Source code in bayes_cbf/misc.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
variable_required_grad(x)
creates context for x requiring gradient
Source code in bayes_cbf/misc.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
|