diff --git a/nn/varstore.go b/nn/varstore.go index dd47c6f..d09d050 100644 --- a/nn/varstore.go +++ b/nn/varstore.go @@ -228,6 +228,7 @@ func (vs *VarStore) LoadPartial(filepath string) ([]string, error) { // missing variable if currTs, ok = namedTensorsMap[tsName]; !ok { missingVariables = append(missingVariables, tsName) + continue } // mismatched shape diff --git a/tensor/util.go b/tensor/util.go index f4e9d01..e5814da 100644 --- a/tensor/util.go +++ b/tensor/util.go @@ -56,9 +56,8 @@ func CMalloc(nbytes int) (dataPtr unsafe.Pointer, buf *bytes.Buffer) { // NOTE: uncomment this cause panic! // defer C.free(unsafe.Pointer(dataPtr)) - // Recall: 1 << 30 = 1 * 2 * 30 - // Ref. See more at https://stackoverflow.com/questions/48756732 - dataSlice := (*[1 << 30]byte)(dataPtr)[:nbytes:nbytes] + // Recall: 1 << 30 = 1 * 2 * 30 = 1073741824 + dataSlice := (*[1 << 32]byte)(dataPtr)[:nbytes:nbytes] // 4294967296 buf = bytes.NewBuffer(dataSlice[:0:nbytes]) return dataPtr, buf