예제 #1
0
파일: array_table.py 프로젝트: kiminh/ddls
    def get_async(self, value):
        """ pull parameter

        Parameters
        ----------
          value: The array-like params
        """
        id = ctypes.c_int()
        check_call(
            LIB.ArrayTableGetAsync(self, handle, value.handle,
                                   ctypes.byref(id)))
        return id
예제 #2
0
파일: array_table.py 프로젝트: kiminh/ddls
    def add_async(self, grad, option={}):
        """ push grads

        Parameters
        ----------
          tensor: The array-like grads
        """
        keys = []
        values = []
        for key, value in option.iteritems():
            keys.append(c_str(key))
            values.append(c_str(value))
        id = ctypes.c_int()
        check_call(
            LIB.ArrayTableGetAsync(self.handle, grad.handle, ctypes.byref(id),
                                   len(keys), c_array(ctypes.c_char_p, keys),
                                   c_array(ctypes.c_char_p, values)))
        return id