tests

conftest

This file is found by pytest and contains fixtures (i.e., common defaults) that can be used for all tests.

class DefaultEnvs[source]

Bases: object

static default_ant()[source]
static default_bit_ds_vel_bt()[source]
static default_bit_ika_pos_bt()[source]
static default_bl_ds_pos_bt()[source]
static default_bl_ds_pos_vx()[source]
static default_bl_ds_vel_bt()[source]
static default_bob()[source]
static default_bobd()[source]
static default_bop2d_bt()[source]
static default_bop2d_vx()[source]
static default_bop5d_bt()[source]
static default_bop5d_vx()[source]
static default_bs_ds_pos_bt()[source]
static default_bs_ds_pos_vx()[source]
static default_cata()[source]
static default_cth()[source]
static default_hop()[source]
static default_hum()[source]
static default_mg_ik_bt()[source]
static default_mg_jnt_bt()[source]
static default_omo()[source]
static default_p3l_ika_bt()[source]
static default_p3l_ika_vx()[source]
static default_p3l_ta_bt()[source]
static default_p3l_ta_vx()[source]
static default_pend()[source]
static default_pi_ika_5l_bt()[source]
static default_pi_ika_6l_vx()[source]
static default_pi_ta_5l_vx()[source]
static default_pi_ta_6l_bt()[source]
static default_qbb()[source]
static default_qcpst()[source]
static default_qcpst_real()[source]
static default_qcpsu()[source]
static default_qcpsu_real()[source]
static default_qq_real()[source]
static default_qqbb_real()[source]
static default_qqst()[source]
static default_qqst_mj()[source]
static default_qqsu()[source]
static default_qqsu_mj()[source]
static default_qqsurcs_bt()[source]
static default_rosen()[source]
static default_wambic()[source]
class DefaultPolicies[source]

Bases: object

static adn_policy(env: Env)[source]
static default_fs()[source]
static dummy_policy(env: Env)[source]
static fnn_policy(env: Env)[source]
static fnn_policy_cuda(env: Env)[source]
static gru_policy(env: Env)[source]
static gru_policy_cuda(env: Env)[source]
static idle_policy(env: Env)[source]
static linear_policy(env: Env)[source]
static linear_policy_cuda(env: Env)[source]
static lstm_policy(env: Env)[source]
static lstm_policy_cuda(env: Env)[source]
static nf_policy(env: Env)[source]
static pst_policy(env: Env)[source]
static rnn_policy(env: Env)[source]
static rnn_policy_cuda(env: Env)[source]
static thfnn_policy(env: Env)[source]
static thgru_policy(env: Env)[source]
static thlstm_policy(env: Env)[source]
static thrnn_policy(env: Env)[source]
static time_policy(env: Env)[source]
static traced_pst_policy(env: Env)[source]
static traced_time_policy(env: Env)[source]
dataset_ts(request)[source]
default_randomizer()[source]
env(request)[source]
policy(request, env)[source]

test_domain_randomization

assert_is_close(param, info_expected)[source]
test_domain_param(dp, num_samples)[source]
test_param_grid()[source]
test_randomizer(default_randomizer)[source]
test_rescaling(default_randomizer)[source]
test_self_paced_domain_param_from_domain_randomizer()[source]
test_self_paced_domain_param_make_broadening()[source]
test_setting_dp_vals(env: SimEnv)[source]

test_environments

test_gym_env(env_name)[source]
test_gym_wrapper(env)[source]
test_init_spaces(env)[source]
test_mujoco_animations(env)[source]
test_panda3d_animations(env, use_render)[source]
test_qbb_kin(servo_ang)[source]
test_quanser_real_wo_connecting(env: RealEnv)[source]
test_rcspysim_animations(env)[source]
test_reset(env)[source]
test_rollout(env)[source]

test_exploration

test_noise_on_act(env: SimEnv, policy: Policy)[source]
test_noise_on_param(env: SimEnv, policy: Policy)[source]

test_logger

test_experiment()[source]
test_save_and_laod_yaml()[source]

test_plotting

test_policies

test_basic_policy_evaluate_packed_padded_sequences(env: Env, policy: RecurrentPolicy)[source]
test_dualrbf_policy(env: Env, dim_mask: int)[source]
test_env_specific(env: Env)[source]
test_export_cpp(env: Env, policy: Policy, tmpdir: str, file_type)[source]
test_export_rcspysim(env: Env, policy: Policy, tmpdir: str)[source]
test_feedforward_policy_batching(env: Env, policy: Policy, batch_size: int)[source]
test_feedforward_policy_one_step(env: Env, policy: Policy)[source]
test_hidden_state_packing_batch()[source]
test_hidden_state_packing_nobatch()[source]
test_indi_nonlin_layer(in_features, same_nonlin, bias, weight)[source]
test_mul_feat(obs_dim: int, idcs: tuple)[source]
test_parameterized_policies_init_param(env: Env, policy: Policy)[source]
test_playback_policy(env: Env, dtype)[source]
test_poly_time_policy(env: Env, cond_lvl: str, cond_final: str, cond_init, overtime_behavior: str, use_cuda: bool)[source]
test_potential_policy_evaluate_packed_padded_sequences(env: Env, policy: RecurrentPolicy)[source]
test_pytorch_recurrent_policy_rollout(env: Env, policy: Policy)[source]
test_rbf_feat_batched(batch_size: int, obs_dim: int, num_feat_per_dim: int, bounds: Tensor)[source]
test_rbf_serial(obs_dim: int, num_feat_per_dim: int, bounds: Tensor)[source]
test_recurrent_policy_batching(env: Env, policy: Policy, batch_size: int)[source]
test_recurrent_policy_one_step(env: Env, policy: Policy)[source]
test_rfb_policy_batch(env: Env, batch_size: int, num_feat_per_dim: int)[source]
test_rfb_policy_serial(env: Env, num_feat_per_dim: int)[source]
test_rff_feat_batched(batch_size: int, obs_dim: int, num_feat_per_dim: int)[source]
test_rff_feat_serial(obs_dim: int, num_feat_per_dim: int)[source]
test_rff_policy_batch(env: Env, batch_size: int, num_feat_per_dim: int)[source]
test_rff_policy_serial(env: Env, num_feat_per_dim: int)[source]
test_script_nonrecurrent(env: Env, policy: Policy)[source]
test_script_recurrent(env: Env, policy: Policy)[source]
test_simple_feature_stack(feat_list: list)[source]
test_time_policy_one_step(env: Env, policy: Policy)[source]
test_twoheaded_policy_evaluate_packed_padded_sequences(env: Env, policy: RecurrentPolicy)[source]

test_rollout_result

NOTE: This file is not using to.testing.assert_allclose because most methods need to work for both torch and numpy.

class DummyNT(part1, part2)[source]

Bases: tuple

Create new instance of DummyNT(part1, part2)

property part1

Alias for field number 0

property part2

Alias for field number 1

mock_data()[source]
test_add_data(mock_data, data_format: str)[source]
test_additional_required(mock_data)[source]
test_advantage_calculation(env, policy)[source]
test_concat(data_format: str)[source]
test_convert(mock_data, other_format, tensor_type)[source]
test_create(mock_data, data_format, tensor_type)[source]
test_namedtuple(mock_data, data_format: str)[source]
test_pickle(mock_data, data_format: str)[source]
test_process(mock_data, data_format: str)[source]
test_replay_memory(mock_data, capacity)[source]
test_slice(mock_data, sls, data_format: str)[source]
test_split_multi(data_format: str)[source]
test_step_iter(mock_data, data_format: str)[source]
test_stepsequence_from_pandas(mock_data, given_rewards: bool)[source]
test_stepsequence_padding(mock_data, data_format: str, pad_value: Union[int, float], pad_len: int)[source]
test_truncate_rollouts(env, num_real_ros, num_sim_ros, max_real_steps, max_sim_steps)[source]

test_sampling

test_boostrap_methods(sample, seed)[source]
test_bootsrapping(data, num_reps, seed)[source]
test_cuda_sampling_w_dr(env: SimEnv, policy: Policy, num_workers: int)[source]
test_parallel_rollout_sampler(env: SimEnv, policy: Policy, num_workers: int)[source]
test_parallel_sampling_deterministic_smoke_test_w_min_steps(tmpdir_factory, env: SimEnv, policy: Policy, algo, min_rollouts: int, min_steps: int)[source]
test_parallel_sampling_deterministic_smoke_test_wo_min_steps(tmpdir_factory, env: SimEnv, policy: Policy, algo, min_rollouts: int)[source]
test_parallel_sampling_deterministic_w_min_steps(env: SimEnv, policy: Policy, min_rollouts: Optional[int], min_steps: int, domain_params: Optional[List[dict]])[source]
test_parallel_sampling_deterministic_wo_min_steps(env: SimEnv, policy: Policy, min_rollouts: Optional[int], init_states: Optional[int], domain_params: Optional[List[dict]])[source]
test_param_expl_sampler(env: SimEnv, policy: Policy, num_init_states_per_domain: int, fixed_init_state: bool, num_domains: int, num_workers: int)[source]
test_parameter_exploration_sampler(env: SimEnv, policy: Policy, num_workers: int)[source]
test_parameter_exploration_sampler_deterministic(env: SimEnv, policy: Policy, num_params: int, num_init_states_per_domain: int, num_domains: int, set_init_states: bool)[source]
test_reparametrization_trick(mean, cov)[source]
test_rollout_wo_exploration(env: SimEnv, policy: Policy)[source]
test_rollout_wo_policy(env: SimEnv)[source]
test_sample_from_unit_sphere_surface(num_dim: int, method: str)[source]
test_sampler_collect(num_threads: int, min_samples: int)[source]
test_sampler_collect_minrun(num_threads: int, min_samples: int, min_runs: int)[source]
test_sampler_pool(arg)[source]
test_select_cvar(epsilon: float, num_ro: int)[source]
test_sequences(sequence: Callable, x_init: ndarray, plot: bool)[source]
test_sequential_equals_parallel(env: SimEnv, policy: Policy, num_rollouts: int, num_workers: int)[source]
test_to_format(data_type: tuple)[source]

test_set_seed

test_out_of_bounds_base_seed(base_seed, sub_seed, sub_sub_seed, expected)[source]

test_spaces

bs(request)[source]
ds(request)[source]
test_cat_box_space(bs_list)[source]
test_cat_discrete_space(ds_list)[source]
test_contains_verbose_box_space()[source]
test_copy_box_space(bs)[source]
test_copy_discrete_space(ds)[source]
test_flat_dim_box_space(bs)[source]
test_project_to_box_space(bs)[source]
test_project_to_discrete_space(ds)[source]
test_sample_contains_box_space(bs)[source]
test_sample_contains_discrete_space(ds)[source]
test_string_representation(bs)[source]
test_subspace_box_space(bs, idcs)[source]
test_torus2D()[source]

test_step_logger

test_consistent_key_order()[source]
test_csv_logger_serializer(tmpdir)[source]
test_empty_step_skip()[source]
test_first_step()[source]
test_late_new_key_error()[source]
test_prefix()[source]
test_tb_logger_serializer(tmpdir)[source]
test_values()[source]

test_tasks

envspec_432()[source]
test_best_state_final_rew_task(envspec_432, rew_fcn, factor)[source]
test_combined_reward_function_step(fcn_list, reset_args, reset_kwargs)[source]
test_composite_task_structure(envspec_432, task_type)[source]
test_condition_only_task(envspec_432, condition_fcn, is_success_condition)[source]
test_modulated_rew_fcn()[source]
test_parallel_task_function(envspec_432, hold_rew_when_done)[source]
test_rew_fcn_constructor(state_space, act_space)[source]
test_sequential_task_function(envspec_432, hold_rew_when_done)[source]
test_set_goals_fo_composite_tasks(sub_tasks)[source]
test_tracking_task(envspec_432, rew_fcn)[source]

test_tensor_utils

test_insert_tensor_col(orig, col)[source]
test_stack_tensor_dicts()[source]
test_stack_tensors()[source]
test_stack_tensors_scalar()[source]

test_utils

test_check_all_equal(x, b)[source]
test_check_all_lengths_equal(x, b)[source]
test_check_all_shapes_equal(x, b)[source]
test_check_all_types_equal(x, b)[source]
test_check_prompt()[source]
test_concat_rollouts(env, expl_strat)[source]
test_correct_atleast_2d(x)[source]
test_cosine_similarity(x, y)[source]
test_cov(x, data_along_rows)[source]
test_diff_coeffs(s, d, h)[source]
test_ds_spec(g, ed)[source]
test_gen_batch_idcs(batch_size, data_size, sorted)[source]
test_gen_ordered_batches(data, batch_size)[source]
test_gss_optimizer_functional()[source]
test_gss_optimizer_identical_bounds(identical_bounds)[source]
test_gss_optimizer_nlin_fcn()[source]
test_is_iterator(x, b)[source]
test_is_sequence(x, b)[source]
test_iteration_tracker()[source]
test_logmeanexp(x, dim)[source]
test_merge_lod_var_dtype(x, y)[source]
test_minmaxscaler(dtype, lb, ub)[source]
test_normalize(dtype, axis)[source]
test_print_cbt_once(color, bright)[source]
test_repeat_interleave(seq, num_reps)[source]
test_rmse(type, dim)[source]
test_running_expdecay_average(data_seq, alpha)[source]
test_running_mem_average(data_seq, capacity)[source]
test_running_normalizer(data_seq)[source]
test_running_standardizer(data_seq, axis)[source]
test_save_load(obj, file_ext: str, tmpdir, prefix: str, suffix: str, use_state_dict: bool, verbose: bool)[source]
test_scale_min_max(dtype, lb, ub)[source]
test_skyline(dt: Union[int, float], t_end: Union[int, float], t_intvl_space: BoxSpace, val_space: BoxSpace)[source]
test_stateful_standardizer(data_type: str, shape: tuple)[source]
test_transformations(transformation, value, transformed_value)[source]
test_update_matching_keys_recursively(base, updater)[source]

Module contents