fixed pickle with zero data length
This commit is contained in:
parent
8eab6a5bbd
commit
e43f22df69
|
@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
- Fixed pickle with zero data length
|
||||
- Added `gotch.CleanCache()` API.
|
||||
|
||||
## [Nofix]
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"math/big"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -75,6 +76,11 @@ func Decode(filename string) (map[string]*ts.Tensor, error) {
|
|||
// log.Printf("data: %v\n", data)
|
||||
|
||||
// Dealing with Pytorch `..._tracked` variables.
|
||||
if reflect.ValueOf(data).Len() == 0 {
|
||||
log.Printf("INFO: skip weigth %q with zero data length.\n", name.(string))
|
||||
continue
|
||||
}
|
||||
|
||||
// TODO. should we just skip them?
|
||||
if reflect.ValueOf(data).Len() == 1 && len(size) == 0 {
|
||||
size = []int64{1}
|
||||
|
|
Loading…
Reference in New Issue
Block a user