def get_rnn_lin_layer_matrix_params( handle, rnn_desc, layer, x_desc, w_desc, w, lin_layer_id): mat_desc = Descriptor(cudnn.createFilterDescriptor(), cudnn.destroyFilterDescriptor) ptr = numpy.array(0, dtype=numpy.intp) cudnn.getRNNLinLayerMatrixParams( handle, rnn_desc.value, layer, x_desc.value, w_desc.value, w.data.ptr, lin_layer_id, mat_desc.value, ptr.ctypes.data) offset = (ptr - w.data.ptr) // 4 _, _, _, dim = cudnn.getFilterNdDescriptor(mat_desc.value, 3) size = internal.prod(dim) mat = w[offset: offset + size] return mat
def get_rnn_lin_layer_matrix_params( handle, rnn_desc, layer, x_desc, w_desc, w, lin_layer_id): mat_desc = Descriptor(cudnn.createFilterDescriptor(), cudnn.destroyFilterDescriptor) ptr = numpy.array(0, dtype=numpy.intp) cudnn.getRNNLinLayerMatrixParams( handle, rnn_desc.value, layer, x_desc.value, w_desc.value, w.data.ptr, lin_layer_id, mat_desc.value, ptr.ctypes.data) offset = (ptr - w.data.ptr) // 4 _, _, _, dim = cudnn.getFilterNdDescriptor(mat_desc.value, 3) size = numpy.prod(dim) mat = w[offset: offset + size] return mat