def to_configs(states, verbose=True, **kwargs):
base = setting['base']
width = states.shape[1] // base
height = states.shape[1] // base
load(width,height)
def build():
P = len(setting['panels'])
states = Input(shape=(height*base,width*base))
error = build_error(states, height, width, base)
matches = 1 - K.clip(K.sign(error - threshold),0,1)
# a, h, w, panel
matches = K.reshape(matches, [K.shape(states)[0], height * width, -1])
# a, pos, panel
matches = K.permute_dimensions(matches, [0,2,1])
# a, panel, pos
config = matches * K.arange(height*width,dtype='float')
config = K.sum(config, axis=-1)
return Model(states, wrap(states, config))
model = build()
return model.predict(states, **kwargs)
评论列表
文章目录