我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用torch.backends.cudnn._sizeofmap()。
def get_num_weights(handle, rnn_desc, x_desc, datatype): weight_size = ctypes.c_long() check_error(cudnn.lib.cudnnGetRNNParamsSize( handle, rnn_desc, x_desc, ctypes.byref(weight_size), datatype )) elem_size = cudnn._sizeofmap[datatype] assert(weight_size.value % elem_size == 0) return weight_size.value // elem_size
def get_num_weights(handle, rnn_desc, x_desc, datatype): weight_size = ctypes.c_long() check_error(cudnn.lib.cudnnGetRNNParamsSize( handle, rnn_desc, x_desc, ctypes.byref(weight_size), datatype )) elem_size = cudnn._sizeofmap[datatype] assert weight_size.value % elem_size == 0 return weight_size.value // elem_size