Example #1
0
def new_solver(learning_rate):
    param = SolverParameter()
    param.solver_type = SolverParameter.ADAM
    param.momentum = 0.95
    param.base_lr = learning_rate
    param.lr_policy = "step"
    param.gamma = 0.1
    param.stepsize = 10000000
    param.max_iter = 10000000
    param.display = 0
    param.clip_gradients = 10
    return param
Example #2
0
import ctypes
from caffe_ext import layers as L
from caffe.proto.caffe_pb2 import SolverParameter
import numpy as np

param = SolverParameter()
param.solver_type = param.ADAM

lib = ctypes.cdll.LoadLibrary("/root/code/dqn-info/build/libdqn-c-lib.so")
lib.DQN_new.argtypes = [
    ctypes.c_char_p,
    ctypes.c_char_p,
    ctypes.c_char_p,
    ctypes.c_char_p,
    ctypes.c_char_p,
    ctypes.c_int,
    ctypes.c_int,
    ctypes.c_int,
    ctypes.c_int,
    ctypes.c_int,
    ctypes.c_float,
]
lib.DQN_new.returntype = ctypes.c_void_p

lib.DQN_SelectAction.argtypes = [
    ctypes.c_void_p,
    ctypes.POINTER(ctypes.c_float),
    ctypes.POINTER(ctypes.c_float),
]
lib.DQN_SelectAction.returntype = None