本文整理匯總了Python中rllab.misc.ext.AttrDict方法的典型用法代碼示例。如果您正苦於以下問題:Python ext.AttrDict方法的具體用法?Python ext.AttrDict怎麽用?Python ext.AttrDict使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rllab.misc.ext
的用法示例。
在下文中一共展示了ext.AttrDict方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _ivariants_sorted
# 需要導入模塊: from rllab.misc import ext [as 別名]
# 或者: from rllab.misc.ext import AttrDict [as 別名]
def _ivariants_sorted(self, sorted_keys):
if len(sorted_keys) == 0:
yield dict()
else:
first_keys = sorted_keys[:-1]
first_variants = self._ivariants_sorted(first_keys)
last_key = sorted_keys[-1]
last_vals = [v for k, v, _ in self._variants if k == last_key][0]
if hasattr(last_vals, "__call__"):
last_val_keys = inspect.getargspec(last_vals).args
if hasattr(last_vals, 'im_self') or hasattr(last_vals, '__self__'):
last_val_keys = last_val_keys[1:]
else:
last_val_keys = None
for variant in first_variants:
if hasattr(last_vals, "__call__"):
last_variants = last_vals(
**{k: variant[k] for k in last_val_keys})
for last_choice in last_variants:
yield AttrDict(variant, **{last_key: last_choice})
else:
for last_choice in last_vals:
yield AttrDict(variant, **{last_key: last_choice})
示例2: load_exps_data
# 需要導入模塊: from rllab.misc import ext [as 別名]
# 或者: from rllab.misc.ext import AttrDict [as 別名]
def load_exps_data(exp_folder_paths,disable_variant=False):
exps = []
for exp_folder_path in exp_folder_paths:
exps += [x[0] for x in os.walk(exp_folder_path)]
exps_data = []
for exp in exps:
try:
exp_path = exp
params_json_path = os.path.join(exp_path, "params.json")
variant_json_path = os.path.join(exp_path, "variant.json")
progress_csv_path = os.path.join(exp_path, "progress.csv")
progress = load_progress(progress_csv_path)
if disable_variant:
params = load_params(params_json_path)
else:
try:
params = load_params(variant_json_path)
except IOError:
params = load_params(params_json_path)
exps_data.append(ext.AttrDict(
progress=progress, params=params, flat_params=flatten_dict(params)))
except IOError as e:
print(e)
return exps_data