提交 4948b7c8 authored 作者: Dustin Webb's avatar Dustin Webb

Changed documentation comment.

Fixed eq and hash functions.
上级 f3b5fe3b
......@@ -391,12 +391,16 @@ class GpuDnnSoftmax(GpuOp):
Op for the cuDNN Softmax.
Parameters''
-tensor_format: Whether the data has shape 'bc01' or 'b01c'
-tensor_format: Whether the data format is 'bc01' or 'b01c'
-algo: 'fast' or 'accurate' indicating whether computations should be
optimized for speed or accuracy respectively.
-mode: 'instance' or 'channel' indicating whether the data format is
'bc01' or 'b01c' respectively.
-mode: 'instance' or 'channel' indicating whether the softmax should be
computed per image across 'c01' or per spationali location '01' per image
across 'c'.
"""
__props__ = ('tensor_format', 'mode', 'algo')
def __init__(self, tensor_format, algo, mode):
assert(tensor_format in ('bc01', 'b01c'))
self.tensor_format = tensor_format
......@@ -407,12 +411,6 @@ class GpuDnnSoftmax(GpuOp):
assert(mode in ('instance', 'channel'))
self.mode = mode
def __eq__(self, other):
return type(self) == type(other)
def __hash__(self):
return hash(type(self))
def __str__(self):
return self.__class__.__name__
......@@ -521,14 +519,16 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
%(fail)s
}
CudaNdarray_prep_output(&(%(outs)s), 4, CudaNdarray_HOST_DIMS(%(ins)s));
err%(name)s = cudnnSetTensor4dDescriptor(
softmax_output_%(id)d,
format%(id)d,
CUDNN_DATA_FLOAT,
CudaNdarray_HOST_DIMS(%(ins)s)[0],
CudaNdarray_HOST_DIMS(%(ins)s)[1],
CudaNdarray_HOST_DIMS(%(ins)s)[2],
CudaNdarray_HOST_DIMS(%(ins)s)[3]
CudaNdarray_HOST_DIMS(%(outs)s)[0],
CudaNdarray_HOST_DIMS(%(outs)s)[1],
CudaNdarray_HOST_DIMS(%(outs)s)[2],
CudaNdarray_HOST_DIMS(%(outs)s)[3]
);
if (err%(name)s != CUDNN_STATUS_SUCCESS) {
PyErr_Format(PyExc_RuntimeError, "could not set out descriptor: %%s",
......@@ -536,8 +536,6 @@ if (err%(name)s != CUDNN_STATUS_SUCCESS) {
%(fail)s
}
CudaNdarray_prep_output(&(%(outs)s), 4, CudaNdarray_HOST_DIMS(%(ins)s));
err%(name)s = cudnnSoftmaxForward(
softmax_handle_%(id)d,
algo%(id)d,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论