forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SparseLinear.cu
85 lines (75 loc) · 2.57 KB
/
SparseLinear.cu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <THCUNN/THCUNN.h>
#include <TH/THHalf.h>
#include <THCUNN/THCHalfAutoNumerics.cuh>
#include <THC/THCTensor.hpp>
#include <cusparse.h>
static cusparseHandle_t cusparse_handle = 0;
static void init_cusparse() {
if (cusparse_handle == 0) {
cusparseStatus_t status = cusparseCreate(&cusparse_handle);
if (status != CUSPARSE_STATUS_SUCCESS) {
THError("CUSPARSE Library initialization failed");
}
}
}
void THNN_CudaHalfSparseLinear_updateOutput(
THCState *state,
THCudaHalfTensor *input,
THCudaHalfTensor *output,
THCudaHalfTensor *weight,
THCudaHalfTensor *bias) {
THError("THCudaHalfTensor not supported with SparseLinear");
}
void THNN_CudaHalfSparseLinear_accGradParameters(
THCState *state,
THCudaHalfTensor *input,
THCudaHalfTensor *gradOutput,
THCudaHalfTensor *gradWeight,
THCudaHalfTensor *gradBias,
THCudaHalfTensor *weight,
THCudaHalfTensor *bias,
float weightDecay,
float scale) {
THError("THCudaHalfTensor not supported with SparseLinear");
}
void THNN_CudaHalfSparseLinear_legacyUpdateOutput(
THCState *state,
THCudaHalfTensor *input,
THCudaHalfTensor *output,
THCudaHalfTensor *weight,
THCudaHalfTensor *bias) {
THError("THCudaHalfTensor not supported with SparseLinear");
}
void THNN_CudaHalfSparseLinear_legacyAccGradParameters(
THCState *state,
THCudaHalfTensor *input,
THCudaHalfTensor *gradOutput,
THCudaHalfTensor *gradWeight,
THCudaHalfTensor *gradBias,
THCudaHalfTensor *weight,
THCudaHalfTensor *bias,
float weightDecay,
float scale) {
THError("THCudaHalfTensor not supported with SparseLinear");
}
void THNN_CudaHalfSparseLinear_zeroGradParameters(
THCState *state,
THCudaHalfTensor *gradWeight,
THCudaHalfTensor *gradBias,
THCudaHalfTensor *lastInput) {
THError("THCudaHalfTensor not supported with SparseLinear");
}
void THNN_CudaHalfSparseLinear_updateParameters(
THCState *state,
THCudaHalfTensor *weight,
THCudaHalfTensor *bias,
THCudaHalfTensor *gradWeight,
THCudaHalfTensor *gradBias,
THCudaHalfTensor *lastInput,
float learningRate) {
THError("THCudaHalfTensor not supported with SparseLinear");
}
#include <THCUNN/generic/SparseLinear.cu>
#include <THC/THCGenerateFloatType.h>
#include <THCUNN/generic/SparseLinear.cu>
#include <THC/THCGenerateDoubleType.h>