예제 #1
0
Layer.create = staticmethod(_create)
Layer.release = _release_deep
Layer.forward = _forward
Layer.backward = _backward
Layer.initForward = _initForward
Layer.initBackward = _initBackward
Layer.update = _update
Layer.initUpdate = _initUpdate
Layer.getLeftTerminal = _getLeftTerminal
Layer.getRightTerminal = _getRightTerminal
Layer.link = _link
Layer.setLearningData = _setLearningData


Layer.name = property(_getName, _setName)
Layer.out = property(_getOut, _setOut)
Layer.dx = property(_getDx, _setDx)
Layer.updateList = property(_getUpdateList, _setUpdateList)
Layer.extra = property(_getExtra, _setExtra)
Layer.inLayer = property(_getInLayer, _setInLayer)
Layer.outLayer = property(_getOutLayer, _setOutLayer)
Layer.childLayer = property(_getChildLayer, _setChildLayer)
Layer.childLayer_size = property(_getChildLayerSize, _setChildLayerSize)
Layer._forward = property(_getForward, _setForward)
Layer._backward = property(_getBackward, _setBackawrd)
Layer._initForward = property(_getInitForward, _setInitForward)
Layer._initBackward = property(_getInitBackward, _setInitBackward)
Layer._release = property(_getRelease, _setRelease)
Layer._update = property(_getUpdate, _setUpdate)

예제 #2
0
def _create(learning_rate, update, initUpdate):
    return lib.cnn_create_optimizer(learning_rate, update, initUpdate)


def _release(self):
    lib.cnn_release_optimizer(self)


cnn_optimizer_callback_update = CFUNCTYPE(None, POINTER(_Optimizer),
                                          UpdateList, c_int, c_int)
cnn_optimizer_callback_initUpdate = CFUNCTYPE(None, POINTER(_Optimizer),
                                              UpdateList)

lib.cnn_optimizer_update.argtypes = (POINTER(_Optimizer), UpdateList)
lib.cnn_optimizer_initUpdate.argtypes = [POINTER(_Optimizer), UpdateList]

lib.cnn_create_optimizer.argtypes = (c_int, cnn_optimizer_callback_update,
                                     cnn_optimizer_callback_initUpdate)
lib.cnn_create_optimizer.restype = POINTER(_Optimizer)
lib.cnn_release_optimizer.argtypes = [POINTER(_Optimizer)]

Optimizer = POINTER(_Optimizer)
Optimizer.__doc__ = " cnn_Optimizer 구조체의 포인터에 프로퍼티와 메소드를 추가한 클래스입니다."
Optimizer.learning_raate = property(_getLearningRate, _setLearningRate)
Optimizer._update = property(_getUpdate, _setUpdate)
Optimizer.create = staticmethod(_create)
Optimizer.release = _release
Optimizer.update = _update
Optimizer.initUpdate = _initUpdate