本文整理汇总了Python中pybullet_utils.logger.Logger.configure_output_file方法的典型用法代码示例。如果您正苦于以下问题:Python Logger.configure_output_file方法的具体用法?Python Logger.configure_output_file怎么用?Python Logger.configure_output_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybullet_utils.logger.Logger
的用法示例。
在下文中一共展示了Logger.configure_output_file方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Logger
# 需要导入模块: from pybullet_utils.logger import Logger [as 别名]
# 或者: from pybullet_utils.logger.Logger import configure_output_file [as 别名]
from pybullet_utils.logger import Logger
logger = Logger()
logger.configure_output_file("e:/mylog.txt")
for i in range (10):
logger.log_tabular("Iteration", 1)
Logger.print2("hello world")
logger.print_tabular()
logger.dump_tabular()
示例2: RLAgent
# 需要导入模块: from pybullet_utils.logger import Logger [as 别名]
# 或者: from pybullet_utils.logger.Logger import configure_output_file [as 别名]
class RLAgent(ABC):
class Mode(Enum):
TRAIN = 0
TEST = 1
TRAIN_END = 2
NAME = "None"
UPDATE_PERIOD_KEY = "UpdatePeriod"
ITERS_PER_UPDATE = "ItersPerUpdate"
DISCOUNT_KEY = "Discount"
MINI_BATCH_SIZE_KEY = "MiniBatchSize"
REPLAY_BUFFER_SIZE_KEY = "ReplayBufferSize"
INIT_SAMPLES_KEY = "InitSamples"
NORMALIZER_SAMPLES_KEY = "NormalizerSamples"
OUTPUT_ITERS_KEY = "OutputIters"
INT_OUTPUT_ITERS_KEY = "IntOutputIters"
TEST_EPISODES_KEY = "TestEpisodes"
EXP_ANNEAL_SAMPLES_KEY = "ExpAnnealSamples"
EXP_PARAM_BEG_KEY = "ExpParamsBeg"
EXP_PARAM_END_KEY = "ExpParamsEnd"
def __init__(self, world, id, json_data):
self.world = world
self.id = id
self.logger = Logger()
self._mode = self.Mode.TRAIN
assert self._check_action_space(), \
Logger.print2("Invalid action space, got {:s}".format(str(self.get_action_space())))
self._enable_training = True
self.path = Path()
self.iter = int(0)
self.start_time = time.time()
self._update_counter = 0
self.update_period = 1.0 # simulated time (seconds) before each training update
self.iters_per_update = int(1)
self.discount = 0.95
self.mini_batch_size = int(32)
self.replay_buffer_size = int(50000)
self.init_samples = int(1000)
self.normalizer_samples = np.inf
self._local_mini_batch_size = self.mini_batch_size # batch size for each work for multiprocessing
self._need_normalizer_update = True
self._total_sample_count = 0
self._output_dir = ""
self._int_output_dir = ""
self.output_iters = 100
self.int_output_iters = 100
self.train_return = 0.0
self.test_episodes = int(0)
self.test_episode_count = int(0)
self.test_return = 0.0
self.avg_test_return = 0.0
self.exp_anneal_samples = 320000
self.exp_params_beg = ExpParams()
self.exp_params_end = ExpParams()
self.exp_params_curr = ExpParams()
self._load_params(json_data)
self._build_replay_buffer(self.replay_buffer_size)
self._build_normalizers()
self._build_bounds()
self.reset()
return
def __str__(self):
action_space_str = str(self.get_action_space())
info_str = ""
info_str += '"ID": {:d},\n "Type": "{:s}",\n "ActionSpace": "{:s}",\n "StateDim": {:d},\n "GoalDim": {:d},\n "ActionDim": {:d}'.format(
self.id, self.NAME, action_space_str[action_space_str.rfind('.') + 1:], self.get_state_size(), self.get_goal_size(), self.get_action_size())
return "{\n" + info_str + "\n}"
def get_output_dir(self):
return self._output_dir
def set_output_dir(self, out_dir):
self._output_dir = out_dir
if (self._output_dir != ""):
self.logger.configure_output_file(out_dir + "/agent" + str(self.id) + "_log.txt")
return
output_dir = property(get_output_dir, set_output_dir)
def get_int_output_dir(self):
return self._int_output_dir
def set_int_output_dir(self, out_dir):
self._int_output_dir = out_dir
return
int_output_dir = property(get_int_output_dir, set_int_output_dir)
#.........这里部分代码省略.........