Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
    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