Dataset balancing
Helper functions used to balance a dataset.
Qircuit length balancing
get_tensor_gate_length
get_tensor_gate_length (clr_tensor:torch.Tensor, padding_token:int=0)
Returns the gate count of a tokenized circuit. Make sure you use use the correct padding_token
.
add_balance_fn_quantile_qc_length
add_balance_fn_quantile_qc_length (indices:Union[numpy.ndarray,torch.Ten sor], x:Union[numpy.ndarray,torch.Tensor], y:Union[numpy.ndarray,torch.Tensor], *z, padding_token:int=0, balance_quantile:float=0.5, device:tor ch.device=device(type='cpu'), quantile _length_weights:Optional[Callable[[tor ch.Tensor,torch.Tensor],torch.Tensor]] =None)
Balances according to gate length.