From 66cea05f282c7c100b33b137bf10cdaf05620df2 Mon Sep 17 00:00:00 2001 From: sugarme Date: Sat, 19 Feb 2022 16:59:33 +1100 Subject: [PATCH] fixed #67 --- CHANGELOG.md | 1 + libtch/tensor.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 539f624..12f10bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - added nn.BatchNorm.Forward() with default training=true - added exposing `tensor.Ctensor()` - added API `tensor.FromCtensor()` +- [#67]: fixed incorrect type casting at `atc_cuda_count` ## [Nofix] - ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box. diff --git a/libtch/tensor.go b/libtch/tensor.go index 9ec1dfd..b2f9d92 100644 --- a/libtch/tensor.go +++ b/libtch/tensor.go @@ -111,9 +111,9 @@ func GetAndResetLastErr() *C.char { } // int atc_cuda_device_count(); -func AtcCudaDeviceCount() int { +func AtcCudaDeviceCount() int32 { result := C.atc_cuda_device_count() - return *(*int)(unsafe.Pointer(&result)) + return *(*int32)(unsafe.Pointer(&result)) } // int atc_cuda_is_available();