def _set_indexed_value(self, key, new_value, error_type: Type[Exception]=RuntimeError):
    (real_key, index) = self._process_key(key, self._index, error_type)
    value = self._get_keyed_value(real_key, error_type=error_type)
    if isinstance(value, (to.Tensor, np.ndarray)):
        value[(index, ...)] = new_value
    elif isinstance(value, list):
        value[index] = new_value
    else:
        raise error_type(f'Entry {key} has un-settable type {type(value)}')
def _set_indexed_value(self, key, new_value, error_type: Type[Exception]=RuntimeError):
    (real_key, index) = self._process_key(key, self._index, error_type)
    value = self._get_keyed_value(real_key, error_type=error_type)
    if isinstance(value, (to.Tensor, np.ndarray)):
        value[(index, ...)] = new_value
    elif isinstance(value, list):
        value[index] = new_value
    else:
        raise error_type(f'Entry {key} has un-settable type {type(value)}')