temp fixed huge lr groups returned from C
This commit is contained in:
parent
b536d800d2
commit
77031295cb
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Fixed temporary fix huge number of learning group returned from C at `libtch/tensor.go AtoGetLearningRates`
|
||||
|
||||
## [Nofix]
|
||||
- ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box.
|
||||
|
||||
|
|
|
@ -464,6 +464,12 @@ func AtoGetLearningRates(coptimizer Coptimizer) []float64 {
|
|||
C.ato_get_learning_rates(coptimizer, cLRsPtr, cngroup)
|
||||
ngroup := *(*int)(unsafe.Pointer(cngroup))
|
||||
|
||||
// NOTE. temp fix `panic: runtime error: makeslice: len out of range`
|
||||
// due to error in C side with ngroup ridiculous huge number (ie. ngroup: 139745350909953)
|
||||
if ngroup > 1000 {
|
||||
ngroup = 1
|
||||
}
|
||||
|
||||
var lrs []float64 = make([]float64, ngroup)
|
||||
var currPtr *C.double = cLRsPtr
|
||||
for i := 0; i < ngroup; i++ {
|
||||
|
|
Loading…
Reference in New Issue
Block a user