Skip to content

Commit

Permalink
Remove accreal typedef because it is defined multiple times
Browse files Browse the repository at this point in the history
with nn.
  • Loading branch information
gchanan committed Feb 22, 2017
1 parent 491fccf commit 172c82e
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions THCUNN.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,16 @@ local replacements_generic =
['THCTensor'] = 'THCudaTensor',
['THCIndexTensor'] = 'THCudaLongTensor',
['TYPE'] = 'Cuda',
['real'] = 'float',
['accreal'] = 'float',
},
{
['THCTensor'] = 'THCudaDoubleTensor',
['THCIndexTensor'] = 'THCudaLongTensor',
['TYPE'] = 'CudaDouble',
['real'] = 'double',
['accreal'] = 'double',
}
}

-- gsub(s, 'real', 'float') changes accreal to accfloat.
-- typedef accfloat ahead of time.
ffi.cdef("typedef float accfloat;")
-- gsub(s, 'real', 'double') changes accreal to accfloat.
-- typedef accdouble ahead of time
ffi.cdef("typedef double accdouble;")

if cutorch.hasHalf then
ffi.cdef("half THC_float2half(float a);")
ffi.cdef("float THC_half2float(half a);")
Expand All @@ -70,12 +63,9 @@ if cutorch.hasHalf then
['THCTensor'] = 'THCudaHalfTensor',
['THCIndexTensor'] = 'THCudaLongTensor',
['TYPE'] = 'CudaHalf',
['real'] = 'half',
['accreal'] = 'float',
}
table.insert(replacements_generic, half_replacement)
-- gsub(s, 'real', 'double') changes accreal to accfloat.
-- typedef acchalf ahead of time
ffi.cdef("typedef float acchalf;")
end

for i=1,#replacements_generic do
Expand Down

0 comments on commit 172c82e

Please sign in to comment.