'Copy host array to device.
Arguments:
ary: host array, needs to be contiguous
Returns:
GPUTensor: self'

def set(self, ary):

    stream = self.backend.stream
    if (ary.size != self.size):
        raise TypeError('ary.size    {}    !=    self.size    {}'.format(ary.size, self.size))
    assert self.is_contiguous, 'Array    in    set()    must    be    contiguous'
    if (ary.dtype is not self.dtype):
        ary = ary.astype(self.dtype)
    if (ary.ndim < self._min_dims):
        ary = ary.reshape(ary.size, 1)
    strides = tuple(((self.dtype.itemsize * s) for s in self.strides))
    if (ary.strides != strides):
        raise TypeError('ary.strides    !=    self.strides    *    self.dtype.itemsize    :    {}    !=    {}    *    {}'.format(ary.strides, self.strides, self.dtype.itemsize))
    drv.memcpy_htod_async(int(self.gpudata), ary, stream)
    return self
