fix minor compatibility errors with Py3.*

This commit is contained in:
Brian Delhaisse
2019-07-27 15:46:47 +02:00
parent 12d25bee8a
commit cda185fa25
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -232,7 +232,7 @@ class Updater(object):
raise TypeError("Expecting the given ticks to be a dictionary, instead got: {}".format(type(ticks)))
# check first the items already present in the ticks
for key, value in ticks.iteritems():
for key, value in ticks.items():
# check that the key is a Loss or ParamaterUpdater
if not isinstance(key, (Loss, ParameterUpdater)):
raise TypeError("Expecting the given key for the tick to be an instance of `Loss` or "
+1 -1
View File
@@ -380,7 +380,7 @@ class ExperienceReplay(DictStorage): # ExperienceReplayStorage(DictStorage):
batch = {}
# go through each attribute in the and sample from the tensors
for key, value in self.iteritems():
for key, value in self.items():
if isinstance(value, list): # value = list of tensors
batch[key] = [val[indices] for val in value]
else: # value = tensor
+2 -2
View File
@@ -686,7 +686,7 @@ class Batch(DictStorage):
# print other variables
tmp = {'states', 'actions', 'rewards', 'masks', 'returns'}
for key, value in kwargs.iteritems():
for key, value in kwargs.items():
if key not in tmp:
print("{}: {}".format(key, value))
@@ -1166,7 +1166,7 @@ class RolloutStorage(DictStorage): # TODO: think about when multiple policies:
# print("Indices: {}".format(indices))
# go through each attribute and sample from the tensors
for key, value in self.iteritems():
for key, value in self.items():
# print("batch - add key: {}".format(key))
if isinstance(value, list): # value = list of tensors
batch[key] = [sample(val, indices) for val in value] # [[I, *shape] for each shape]
+1 -1
View File
@@ -269,7 +269,7 @@ class World(object):
world = self.__class__(simulator=simulator, gravity=gravity)
# load bodies in world
for id_, items in self.ids.iteritems():
for id_, items in self.ids.items():
if not isinstance(items, list):
items = [items]
for item in items: