transpose tensor and matmul autograd
This commit is contained in:
parent
6aa18f0e36
commit
f7cc7c8203
2 changed files with 2 additions and 3 deletions
|
|
@ -57,7 +57,7 @@ __host__ void add_tensor_cuda(Tensor* tensor1, Tensor* tensor2, float* result_da
|
|||
cudaDeviceSynchronize();
|
||||
}
|
||||
|
||||
__global__ void sum_tensor_cuda_kernel(float* data, float* result_data, int size) {
|
||||
_global__ void sum_tensor_cuda_kernel(float* data, float* result_data, int size) {
|
||||
extern __shared__ float sdata[];
|
||||
|
||||
unsigned int tid = threadIdx.x;
|
||||
|
|
@ -73,7 +73,7 @@ __global__ void sum_tensor_cuda_kernel(float* data, float* result_data, int size
|
|||
|
||||
// Reduce within block using shared memory
|
||||
for (unsigned int s = blockDim.x / 2; s > 0; s >>= 1) {
|
||||
if (tid < s) {
|
||||
if (tid < s && i + s < size) {
|
||||
sdata[tid] += sdata[tid + s];
|
||||
}
|
||||
__syncthreads();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ class Tensor:
|
|||
|
||||
if data != None:
|
||||
data, shape = self.flatten(data)
|
||||
# Adjust the path to the shared library
|
||||
self.data_ctype = (ctypes.c_float * len(data))(*data)
|
||||
self.shape_ctype = (ctypes.c_int * len(shape))(*shape)
|
||||
self.ndim_ctype = ctypes.c_int(len(shape))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue