You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param[out] output_signal pointer to the final output signal, minimum size = out_time * in_channels. out_time has to be calculated based on the reduction from all the conv and pool layers
16
16
* @param[in] input_signal pointer to the input signal. size = in_time * in_channels
17
+
* @param[in] cnn function pointer for the CNN layer. (any of the conv layers can be passed with appropriate params)
17
18
* @param[in] in_time number of time steps in the input_signal
18
19
* @param[in] in_channels number of input channels
19
20
* @param[in] mean pointer to the mean for the batch normalization, size = in_channels. Pass NULL/0 for affine_config = 2
* @param[out] output_signal pointer to the final output signal, minimum size = out_time * in_channels. out_time has to be calculated based on the reduction from all the conv and pool layers
51
52
* @param[in] input_signal pointer to the input signal. size = in_time * in_channels
53
+
* @param[in] point_cnn function pointer for the point-wise CNN. (any of the conv layers can be passed with appropriate params)
52
54
* @param[in] in_time number of time steps in the input
53
55
* @param[in] in_channels number of input channels
54
56
* @param[in] mean pointer to the mean for the batch normalization, size = in_channels. Pass NULL/0 for affine_config = 2
// Each cell will only calculate half the hidden state i.e. rnn_hidden slots of memory from the start of the output pointer
19
-
// Hence rnn_hidden is used as an offset for the backward pass. The offset for the forward pass is 0
20
-
// This use of an offset is a way to exploit the nature of bi-direction to bypass the concatenation step typically associated with bi-directional passes
21
-
//
22
-
// Constraints
23
-
// For Bi-Directional use, there are 3 constraints
24
-
// 1) (in_time - fwd_window) % hop == 0 and (in_time - bwd_window) % hop == 0
25
-
// 2) fwd_window % hop == 0 and bwd_window % hop == 0
26
-
// 3) sample_first_brick and sample_last_brick = 1
27
-
//
28
-
// Violation of these constraints can lead to one of the following issues
29
-
// 1) segmentation faults
30
-
// 2) forward out_time != backward out_time
31
-
// 3) mismatch between forward index and backward index during sampling i.e forward index 8 would correspond to backward index 6. This index error continues for all consecutive bricks
32
-
// Hence, padding of the input and appropriate window choice is necessary
33
-
//
34
-
// These constraints can be ignored while performing uni-directional passes. However, it is favorable to follow constraints 1 and 2
15
+
Violation of the above two constraints (1 & 2), will cause segmentation faults
16
+
The layers first compute all the Wx steps and then compute Uh for all the windows parallelly
17
+
Hence, the user needs to adhered to the constraints 1 & 2
35
18
19
+
-> Bi-directional Computation
20
+
For bi-directional cases, there are 2 additionally constraints that would need to be followed
21
+
A) sample_first_brick and sample_last_brick = 1
22
+
B) An offset of rnn_hidden would need to be given to the output_signal pointer during the backward function call
23
+
Each function will only process its given context(forward/backward). The other context will need to be called separately.
* @param[in] window window length for each brick. For the final brick, the left over time steps are used(need not be window in length for the last brick)
44
74
* @param[in] hop hop distance for between bricks
45
-
* @param[in] rnn function pointer to the RNN
46
75
* @param[in] params pointer to the parameters for the RNN
47
-
* @param[in,out] buffers pointer to buffer for the RNN
48
76
* @param[in] bi_direction determine if the ouput if for a bi-directional RNN.
49
77
* @param[in] sample_first_brick determine if the 1st brick should also be sampled
50
78
* -> if = 0, only the last hidden state of each brick is sampled. out_time = (in_time-window)/hop + 1
51
79
* -> if = 1, for the 1st brick, we sample every hop index(similar to ::hop). For all the bricks(including the 1st) we sample the final hiddens state. out_time = in_time/hop + 1
* @param[in] window window length for each brick. For the final brick, the left over time steps are used(need not be window in length for the last brick)
65
93
* @param[in] hop hop distance for between bricks
66
-
* @param[in] rnn function pointer to the RNN
67
94
* @param[in] params pointer to the parameters for the RNN
68
-
* @param[in,out] buffers pointer to buffer for the RNN
69
95
* @param[in] bi_direction determine if the ouput if for a bi-directional RNN.
70
96
* @param[in] sample_last_brick determine if the last brick should also be sampled
71
97
* -> if = 0, only the first(last in reverse) hidden state of each brick is sampled. out_time = (in_time-window)/hop + 1
72
98
* -> if = 1, for the last brick, we sample every hop index in reverse(similar to ::hop in reverse). For all the bricks(including the last) we sample the first hiddens state(last in reverse). out_time = in_time/hop + 1
This function was developed primarily for the conv1d function. This helps bypass the permutation of the time and channel axis
36
-
ret is of size nrows, vec is of size ncols
37
-
mat is of size nrows * ncols, stored in row major
38
-
depthwise is to change the matVec to depthwise specific convolutions
39
-
row_stride is the offset factor between two adjacent rows
40
-
Note : This matrix-vector multiplication is useful for matrices where a certain number of columns are dropped
41
-
For a normal matVec case, this value will be ncols
42
-
Eg : for a 400 x 400 matrix and a 100 length vector, we can consider the top 400 x 100 elements for the multiplication. For this eg ncols will be 100 and row_stride will be 400
43
-
vec_stride is the offset fector between 2 elements in a vector i.e. the elements of a vector are placed at "n" intervals
44
-
For a normal matVec case, this value will be 1
45
-
Eg : For matVec with a 400 x 100 matrix a vector of length 100 is needed. So it's possible to enter a 400 length vector and consider every 4th element. For this ncols will be 100 and vec_stride will be 4*/
34
+
/*
35
+
Matrix-vector multiplication with a row offset
36
+
This function was developed primarily for the conv1d function. This helps bypass the permutation of the time and channel axis
37
+
ret is of size nrows, vec is of size ncols
38
+
mat is of size nrows * ncols, stored in row major
39
+
depthwise is to change the matVec to depthwise specific convolutions
40
+
row_stride is the offset factor between two adjacent rows
41
+
Note : This matrix-vector multiplication is useful for matrices where a certain number of columns are dropped
42
+
For a normal matVec case, this value will be ncols
43
+
Eg : For a 400 x 400 matrix and a 100 length vector, we can consider the top 400 x 100 elements for the multiplication.
44
+
Eg : For a 400 x 400 matrix and a 100 length vector, we can consider the top 400 x 100 elements for the multiplication.
45
+
Eg : For a 400 x 400 matrix and a 100 length vector, we can consider the top 400 x 100 elements for the multiplication.
46
+
For this eg ncols will be 100 and row_stride will be 400
47
+
vec_stride is the offset fector between 2 elements in a vector i.e. the elements of a vector are placed at "n" intervals
48
+
For a normal matVec case, this value will be 1
49
+
Eg : For matVec with a 400 x 100 matrix a vector of length 100 is needed.
50
+
Eg : For matVec with a 400 x 100 matrix a vector of length 100 is needed.
51
+
Eg : For matVec with a 400 x 100 matrix a vector of length 100 is needed.
52
+
So it's possible to enter a 400 length vector and consider every 4th element.
53
+
So it's possible to enter a 400 length vector and consider every 4th element.
54
+
So it's possible to enter a 400 length vector and consider every 4th element.
55
+
For this ncols will be 100 and vec_stride will be 4
0 commit comments