# Path: util/model.py
# class Model(object):
#     def __init__(self, inputs, label, loss, pred, debug=None):
#         self.inputs = inputs
#         self.label = label
#         self.loss = loss
#         self.pred = pred
#         self.debug = debug
# 
# def conv2d(name, x, out_channel, kernel, stride, nl=None):
#     name = functools.partial('{}-{}'.format, name)
#     # W
#     shape = [kernel, kernel, x.get_shape()[3].value, out_channel]
#     W = weight_variable(name('W'), shape)
#     # b
#     b = bias_variable(name('b'), [out_channel])
#     # conv
#     y = tf.nn.conv2d(x, W, strides=[1,stride,stride,1], padding='SAME', name=name('op'))
#     y = y + b
#     # nonlinearty
#     return nl(y) if nl else y


from config import Config
from util.model import Model, conv2d
import tensorflow as tf
import functools
    import numpy as np
#!/usr/bin/python3
#-*-coding:utf-8-*-
#$File: model.py
#$Date: Sat May  7 10:59:45 2016
#$Author: Like Ma <milkpku[at]gmail[dot]com>




def get_model(name):
    name = functools.partial('{}-{}'.format, name)

    self_pos = tf.placeholder(Config.dtype, Config.data_shape, name='self_pos')
    self_ability = tf.placeholder(Config.dtype, Config.data_shape, name='self_ability')
    enemy_pos = tf.placeholder(Config.dtype, Config.data_shape, name='enemy_pos')
    input_label = tf.placeholder(Config.dtype, Config.label_shape, name='input_label')

    x = tf.concat(3, [self_pos, self_ability, enemy_pos], name=name('input_concat'))
    y = input_label

    nl = tf.nn.tanh

    def conv_pip(name, x, nl):
        name = functools.partial('{}_{}'.format, name)

        x = conv2d(name('0'), x, Config.data_shape[3]*2, kernel=3, stride=1, nl=nl)

# Path: util/model.py
# class Model(object):
#     def __init__(self, inputs, label, loss, pred, debug=None):
#         self.inputs = inputs
#         self.label = label
#         self.loss = loss
#         self.pred = pred
#         self.debug = debug
# 
# def conv2d(name, x, out_channel, kernel, stride, nl=None):
#     name = functools.partial('{}-{}'.format, name)
#     # W
#     shape = [kernel, kernel, x.get_shape()[3].value, out_channel]
#     W = weight_variable(name('W'), shape)
#     # b
#     b = bias_variable(name('b'), [out_channel])
#     # conv
#     y = tf.nn.conv2d(x, W, strides=[1,stride,stride,1], padding='SAME', name=name('op'))
#     y = y + b
#     # nonlinearty
#     return nl(y) if nl else y


# Path: policy_experiment/policy.non-constrain/model.py
from config import Config
from util.model import Model, conv2d
import tensorflow as tf
import functools
    import numpy as np

#!/usr/bin/python3
#-*-coding:utf-8-*-
#$File: model.py
#$Date: Sat May  7 10:59:45 2016
#$Author: Like Ma <milkpku[at]gmail[dot]com>




def get_model(name):
    name = functools.partial('{}-{}'.format, name)

    self_pos = tf.placeholder(Config.dtype, Config.data_shape, name='self_pos')
    self_ability = tf.placeholder(Config.dtype, Config.data_shape, name='self_ability')
    enemy_pos = tf.placeholder(Config.dtype, Config.data_shape, name='enemy_pos')
    input_label = tf.placeholder(Config.dtype, Config.label_shape, name='input_label')

    x = tf.concat(3, [self_pos, self_ability, enemy_pos], name=name('input_concat'))
    y = input_label

    nl = tf.nn.tanh

    def conv_pip(name, x, nl):
        name = functools.partial('{}_{}'.format, name)

        x = conv2d(name('0'), x, Config.data_shape[3]*2, kernel=3, stride=1, nl=nl)

        x = conv2d(name('1'), x, Config.data_shape[3], kernel=3, stride=1, nl=nl)