curobo.rollout.dynamics_model.integration_utils module
- curobo.rollout.dynamics_model.integration_utils.build_clique_matrix(horizon, dt, device='cpu', dtype=torch.float32)
- curobo.rollout.dynamics_model.integration_utils.build_fd_matrix(horizon, device='cpu', dtype=torch.float32, order=1, PREV_STATE=False, FULL_RANK=False, SHIFT=False)
- curobo.rollout.dynamics_model.integration_utils.build_int_matrix(horizon, diagonal=0, device='cpu', dtype=torch.float32, order=1, traj_dt=None)
- curobo.rollout.dynamics_model.integration_utils.build_start_state_mask(horizon, tensor_args)
- Parameters:
tensor_args (TensorDeviceType) –
- curobo.rollout.dynamics_model.integration_utils.tensor_step_jerk(state, act, state_seq, dt_h, n_dofs, integrate_matrix, fd_matrix=None)
- Parameters:
state (Tensor) –
act (Tensor) –
state_seq (Tensor) –
dt_h (Tensor) –
n_dofs (int) –
integrate_matrix (Tensor) –
fd_matrix (Optional[Tensor]) –
- Return type:
Tensor
- curobo.rollout.dynamics_model.integration_utils.euler_integrate(q_0, u, diag_dt, integrate_matrix)
- curobo.rollout.dynamics_model.integration_utils.tensor_step_acc(state, act, state_seq, dt_h, n_dofs, integrate_matrix, fd_matrix=None)
- Parameters:
state (Tensor) –
act (Tensor) –
state_seq (Tensor) –
dt_h (Tensor) –
n_dofs (int) –
integrate_matrix (Tensor) –
fd_matrix (Optional[Tensor]) –
- Return type:
Tensor
- class curobo.rollout.dynamics_model.integration_utils.CliqueTensorStep(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, mask, n_mask, fd_1, fd_2, fd_3)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
CliqueTensorStepBackward
- class curobo.rollout.dynamics_model.integration_utils.CliqueTensorStepKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
CliqueTensorStepKernelBackward
- class curobo.rollout.dynamics_model.integration_utils.CliqueTensorStepIdxKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, start_idx, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
CliqueTensorStepIdxKernelBackward
- class curobo.rollout.dynamics_model.integration_utils.CliqueTensorStepCentralDifferenceKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
CliqueTensorStepCentralDifferenceKernelBackward
- class curobo.rollout.dynamics_model.integration_utils.CliqueTensorStepIdxCentralDifferenceKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, start_idx, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
CliqueTensorStepIdxCentralDifferenceKernelBackward
- class curobo.rollout.dynamics_model.integration_utils.CliqueTensorStepCoalesceKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
CliqueTensorStepCoalesceKernelBackward
- class curobo.rollout.dynamics_model.integration_utils.AccelerationTensorStepKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
AccelerationTensorStepKernelBackward
- class curobo.rollout.dynamics_model.integration_utils.AccelerationTensorStepIdxKernel(*args, **kwargs)
Bases:
Function
- static forward(ctx, u_act, start_position, start_velocity, start_acceleration, start_idx, out_position, out_velocity, out_acceleration, out_jerk, traj_dt, out_grad_position)
This function is to be overridden by all subclasses. There are two ways to define forward:
Usage 1 (Combined forward and ctx):
@staticmethod def forward(ctx: Any, *args: Any, **kwargs: Any) -> Any: pass
It must accept a context ctx as the first argument, followed by any number of arguments (tensors or other types).
See combining-forward-context for more details
Usage 2 (Separate forward and ctx):
@staticmethod def forward(*args: Any, **kwargs: Any) -> Any: pass @staticmethod def setup_context(ctx: Any, inputs: Tuple[Any, ...], output: Any) -> None: pass
The forward no longer accepts a ctx argument.
Instead, you must also override the
torch.autograd.Function.setup_context
staticmethod to handle setting up thectx
object.output
is the output of the forward,inputs
are a Tuple of inputs to the forward.See extending-autograd for more details
The context can be used to store arbitrary data that can be then retrieved during the backward pass. Tensors should not be stored directly on ctx (though this is not currently enforced for backward compatibility). Instead, tensors should be saved either with
ctx.save_for_backward
if they are intended to be used inbackward
(equivalently,vjp
) orctx.save_for_forward
if they are intended to be used for injvp
.
- static backward(ctx, grad_out_p, grad_out_v, grad_out_a, grad_out_j)
Defines a formula for differentiating the operation with backward mode automatic differentiation (alias to the vjp function).
This function is to be overridden by all subclasses.
It must accept a context
ctx
as the first argument, followed by as many outputs as theforward
returned (None will be passed in for non tensor outputs of the forward function), and it should return as many tensors, as there were inputs toforward
. Each argument is the gradient w.r.t the given output, and each returned value should be the gradient w.r.t. the corresponding input. If an input is not a Tensor or is a Tensor not requiring grads, you can just pass None as a gradient for that input.The context can be used to retrieve tensors saved during the forward pass. It also has an attribute
ctx.needs_input_grad
as a tuple of booleans representing whether each input needs gradient. E.g.,backward
will havectx.needs_input_grad[0] = True
if the first input toforward
needs gradient computed w.r.t. the output.
- _backward_cls
alias of
AccelerationTensorStepIdxKernelBackward
- curobo.rollout.dynamics_model.integration_utils.tensor_step_pos_clique(state, act, state_seq, mask_matrix, fd_matrix)
- Parameters:
state (JointState) –
act (Tensor) –
state_seq (JointState) –
mask_matrix (List[Tensor]) –
fd_matrix (List[Tensor]) –
- curobo.rollout.dynamics_model.integration_utils.step_acc_semi_euler(state, act, diag_dt, n_dofs, integrate_matrix)
- curobo.rollout.dynamics_model.integration_utils.tensor_step_acc_semi_euler(state, act, state_seq, diag_dt, integrate_matrix, integrate_matrix_pos)
- Parameters:
state (Tensor) –
act (Tensor) –
state_seq (Tensor) –
diag_dt (int) –
integrate_matrix (Tensor) –
integrate_matrix_pos (Optional[Tensor]) –
- Return type:
Tensor
- curobo.rollout.dynamics_model.integration_utils.tensor_step_vel(state, act, state_seq, dt_h, n_dofs, integrate_matrix, fd_matrix)
- Parameters:
state (Tensor) –
act (Tensor) –
state_seq (Tensor) –
dt_h (Tensor) –
n_dofs (int) –
integrate_matrix (Tensor) –
fd_matrix (Tensor) –
- Return type:
Tensor
- curobo.rollout.dynamics_model.integration_utils.tensor_step_pos(state, act, state_seq, fd_matrix)
- curobo.rollout.dynamics_model.integration_utils.tensor_step_pos_ik(act, state_seq)
- curobo.rollout.dynamics_model.integration_utils.tensor_linspace(start_tensor, end_tensor, steps=10)
- curobo.rollout.dynamics_model.integration_utils.sum_matrix(h, int_steps, tensor_args)
- curobo.rollout.dynamics_model.integration_utils.interpolate_kernel(h, int_steps, tensor_args)
- Parameters:
tensor_args (TensorDeviceType) –
- curobo.rollout.dynamics_model.integration_utils.action_interpolate_kernel(h, int_steps, tensor_args, offset=4)
- Parameters:
tensor_args (TensorDeviceType) –
offset (int) –