pyepo.utils¶
Package-wide utility functions
Functions¶
|
A global function to get args of model |
|
Normalize a cost vector to a numpy array, detaching torch tensors as needed. |
Module Contents¶
- pyepo.utils.getArgs(model: pyepo.model.opt.optModel) dict¶
A global function to get args of model
- Parameters:
model – optimization model
- Returns:
model args
- Return type:
- pyepo.utils.costToNumpy(c: numpy.ndarray | torch.Tensor | list, dtype=np.float32) numpy.ndarray¶
Normalize a cost vector to a numpy array, detaching torch tensors as needed.
- Parameters:
c – cost vector
dtype – target dtype when
cis not already a tensor; torch tensors are converted via.detach().cpu().numpy()and keep their existing dtype.
- Returns:
numpy cost vector
- Return type:
np.ndarray