mirror of
https://github.com/gryf/coach.git
synced 2025-12-18 19:50:17 +01:00
Cleanup imports.
Till now, most of the modules were importing all of the module objects (variables, classes, functions, other imports) into module namespace, which potentially could (and was) cause of unintentional use of class or methods, which was indirect imported. With this patch, all the star imports were substituted with top-level module, which provides desired class or function. Besides, all imports where sorted (where possible) in a way pep8[1] suggests - first are imports from standard library, than goes third party imports (like numpy, tensorflow etc) and finally coach modules. All of those sections are separated by one empty line. [1] https://www.python.org/dev/peps/pep-0008/#imports
This commit is contained in:
@@ -13,10 +13,10 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import tensorflow as tf
|
||||
import numpy as np
|
||||
from utils import force_list
|
||||
|
||||
import utils
|
||||
|
||||
|
||||
# Used to initialize weights for policy and value output layers
|
||||
@@ -36,7 +36,7 @@ class Head(object):
|
||||
self.loss = []
|
||||
self.loss_type = []
|
||||
self.regularizations = []
|
||||
self.loss_weight = force_list(loss_weight)
|
||||
self.loss_weight = utils.force_list(loss_weight)
|
||||
self.target = []
|
||||
self.input = []
|
||||
self.is_local = is_local
|
||||
@@ -50,12 +50,12 @@ class Head(object):
|
||||
with tf.variable_scope(self.get_name(), initializer=tf.contrib.layers.xavier_initializer()):
|
||||
self._build_module(input_layer)
|
||||
|
||||
self.output = force_list(self.output)
|
||||
self.target = force_list(self.target)
|
||||
self.input = force_list(self.input)
|
||||
self.loss_type = force_list(self.loss_type)
|
||||
self.loss = force_list(self.loss)
|
||||
self.regularizations = force_list(self.regularizations)
|
||||
self.output = utils.force_list(self.output)
|
||||
self.target = utils.force_list(self.target)
|
||||
self.input = utils.force_list(self.input)
|
||||
self.loss_type = utils.force_list(self.loss_type)
|
||||
self.loss = utils.force_list(self.loss)
|
||||
self.regularizations = utils.force_list(self.regularizations)
|
||||
if self.is_local:
|
||||
self.set_loss()
|
||||
self._post_build()
|
||||
|
||||
Reference in New Issue
Block a user