當前位置: 首頁>>代碼示例>>Python>>正文


Python CU.error方法代碼示例

本文整理匯總了Python中cuda4py._py.CU.error方法的典型用法代碼示例。如果您正苦於以下問題:Python CU.error方法的具體用法?Python CU.error怎麽用?Python CU.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在cuda4py._py.CU的用法示例。


在下文中一共展示了CU.error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: exec_z2z

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def exec_z2z(self, idata, odata, direction):
     """Executes a double-precision complex-to-complex
     cuFFT transform plan.
     """
     err = self._lib.cufftExecZ2Z(self.handle, idata, odata, direction)
     if err:
         raise CU.error("cufftExecZ2Z", err)
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:9,代碼來源:_cufft.py

示例2: __init__

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
    def __init__(self, context, rng_type=CURAND_RNG_PSEUDO_DEFAULT):
        """Constructor.

        Parameters:
            context: CUDA context handle or None to use the host generator.
            rng_type: type of the random generator.
        """
        self._context = context
        self._lib = None
        if context is not None:
            context._add_ref(self)
        initialize()
        handle = ffi.new("curandGenerator_t *")
        if context is not None:
            with context:
                err = lib.curandCreateGenerator(handle, int(rng_type))
        else:
            err = lib.curandCreateGeneratorHost(handle, int(rng_type))
        if err:
            self._handle = None
            raise CU.error("curandCreateGenerator" if context is not None
                           else "curandCreateGeneratorHost", err)
        self._lib = lib  # to hold the reference
        self._handle = int(handle[0])
        self._rng_type = int(rng_type)
        self._seed = 0
        self._offset = 0
        self._ordering = 0
        self._dimensions = 0
開發者ID:Samsung,項目名稱:cuda4py,代碼行數:31,代碼來源:_curand.py

示例3: workarea

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def workarea(self, value):
     """Sets workarea for plan execution.
     """
     err = self._lib.cufftSetWorkArea(self.handle, value)
     if err:
         raise CU.error("cufftSetWorkArea", err)
     self._workarea = value
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:9,代碼來源:_cufft.py

示例4: convolution_backward_filter

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
    def convolution_backward_filter(
            self, alpha, src_desc, src_data, diff_desc, diff_data, conv_desc,
            beta, grad_desc, grad_data,
            algo=None, workspace=None, workspace_size=0):
        """Computes gradient for the convolutional kernels.

        Parameters:
            alpha: src_data multiplier (numpy array with one element).
            beta: grad_data multiplier (numpy array with one element).
            src_data: input from the forward pass.
            diff_data: error for backpropagation.
            grad_data: gradient for convolutional kernels.
        """
        if self.version < 4000:
            err = self._lib.cudnnConvolutionBackwardFilter(
                self.handle, CU.extract_ptr(alpha), src_desc, src_data,
                diff_desc, diff_data, conv_desc,
                CU.extract_ptr(beta), grad_desc, grad_data)
        elif algo is None:
            err = self._lib.cudnnConvolutionBackwardFilter_v2(
                self.handle, CU.extract_ptr(alpha), src_desc, src_data,
                diff_desc, diff_data, conv_desc,
                CU.extract_ptr(beta), grad_desc, grad_data)
        else:
            err = self._lib.cudnnConvolutionBackwardFilter(
                self.handle, CU.extract_ptr(alpha), src_desc, src_data,
                diff_desc, diff_data, conv_desc,
                algo, workspace, workspace_size,
                CU.extract_ptr(beta), grad_desc, grad_data)
        if err:
            raise CU.error("cudnnConvolutionBackwardFilter", err)
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:33,代碼來源:_cudnn.py

示例5: exec_d2z

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def exec_d2z(self, idata, odata):
     """Executes a double-precision real-to-complex,
     implicitly forward, cuFFT transform plan.
     """
     err = self._lib.cufftExecD2Z(self.handle, idata, odata)
     if err:
         raise CU.error("cufftExecD2Z", err)
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:9,代碼來源:_cufft.py

示例6: convolution_backward_data

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
    def convolution_backward_data(
            self, alpha, filter_desc, filter_data, diff_desc, diff_data,
            conv_desc, beta, grad_desc, grad_data,
            algo=None, workspace=None, workspace_size=0):
        """Computes backpropagated error.

        Parameters:
            alpha: diff_data multiplier (numpy array with one element).
            beta: grad_data multiplier (numpy array with one element).
            filter_data: convolutional kernels.
            diff_data: error for backpropagation.
            grad_data: backpropagated error.
        """
        if self.version < 4000:
            err = self._lib.cudnnConvolutionBackwardData(
                self.handle, CU.extract_ptr(alpha), filter_desc, filter_data,
                diff_desc, diff_data, conv_desc,
                CU.extract_ptr(beta), grad_desc, grad_data)
        elif algo is None:
            err = self._lib.cudnnConvolutionBackwardData_v2(
                self.handle, CU.extract_ptr(alpha), filter_desc, filter_data,
                diff_desc, diff_data, conv_desc,
                CU.extract_ptr(beta), grad_desc, grad_data)
        else:
            err = self._lib.cudnnConvolutionBackwardData(
                self.handle, CU.extract_ptr(alpha), filter_desc, filter_data,
                diff_desc, diff_data, conv_desc,
                algo, workspace, workspace_size,
                CU.extract_ptr(beta), grad_desc, grad_data)
        if err:
            raise CU.error("cudnnConvolutionBackwardData", err)
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:33,代碼來源:_cudnn.py

示例7: exec_z2d

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def exec_z2d(self, idata, odata):
     """Executes a double-precision complex-to-real,
     implicitly inverse, cuFFT transform plan.
     """
     err = self._lib.cufftExecZ2D(self.handle, idata, odata)
     if err:
         raise CU.error("cufftExecZ2D", err)
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:9,代碼來源:_cufft.py

示例8: exec_c2c

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def exec_c2c(self, idata, odata, direction):
     """Executes a single-precision complex-to-complex
     cuFFT transform plan.
     """
     err = self._lib.cufftExecC2C(self.handle, idata, odata, direction)
     if err:
         raise CU.error("cufftExecC2C", err)
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:9,代碼來源:_cufft.py

示例9: offset

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def offset(self, value):
     """Sets generator offset as an 64-bit integer.
     """
     err = self._lib.curandSetGeneratorOffset(
         self.handle, int(value))
     if err:
         raise CU.error("curandSetGeneratorOffset", err)
     self._offset = int(value)
開發者ID:Samsung,項目名稱:cuda4py,代碼行數:10,代碼來源:_curand.py

示例10: version

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def version(self):
     """Returns cuFFT version.
     """
     version = ffi.new("int *")
     err = self._lib.cufftGetVersion(version)
     if err:
         raise CU.error("cufftGetVersion", err)
     return int(version[0])
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:10,代碼來源:_cufft.py

示例11: ordering

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def ordering(self, value):
     """Sets generator ordering.
     """
     err = self._lib.curandSetGeneratorOrdering(
         self.handle, int(value))
     if err:
         raise CU.error("curandSetGeneratorOrdering", err)
     self._ordering = int(value)
開發者ID:Samsung,項目名稱:cuda4py,代碼行數:10,代碼來源:_curand.py

示例12: seed

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def seed(self, value):
     """Sets generator seed as an 64-bit integer.
     """
     err = self._lib.curandSetPseudoRandomGeneratorSeed(
         self.handle, int(value))
     if err:
         raise CU.error("curandSetPseudoRandomGeneratorSeed", err)
     self._seed = int(value)
開發者ID:Samsung,項目名稱:cuda4py,代碼行數:10,代碼來源:_curand.py

示例13: size

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def size(self):
     """Returns actual size of the work area required to support the plan.
     """
     sz = ffi.new("size_t[]", 4)
     err = self._lib.cufftGetSize(self.handle, sz)
     if err:
         raise CU.error("cufftGetSize", err)
     return int(sz[0])
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:10,代碼來源:_cufft.py

示例14: dimensions

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def dimensions(self, value):
     """Sets quasirandom generator dimensions.
     """
     err = self._lib.curandSetQuasiRandomGeneratorDimensions(
         self.handle, int(value))
     if err:
         raise CU.error("curandSetQuasiRandomGeneratorDimensions", err)
     self._dimensions = int(value)
開發者ID:Samsung,項目名稱:cuda4py,代碼行數:10,代碼來源:_curand.py

示例15: get_pooling_2d_forward_output_dim

# 需要導入模塊: from cuda4py._py import CU [as 別名]
# 或者: from cuda4py._py.CU import error [as 別名]
 def get_pooling_2d_forward_output_dim(pooling_desc, input_desc):
     """Returns tuple of n, c, h, w for an output.
     """
     n, c, h, w = (ffi.new("int *") for _ in range(4))
     err = lib.cudnnGetPooling2dForwardOutputDim(
         pooling_desc, input_desc, n, c, h, w)
     if err:
         raise CU.error("cudnnGetPooling2dForwardOutputDim", err)
     return int(n[0]), int(c[0]), int(h[0]), int(w[0])
開發者ID:nagyistge,項目名稱:cuda4py,代碼行數:11,代碼來源:_cudnn.py


注:本文中的cuda4py._py.CU.error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。