Merge pull request #60 from sugarme/ivalue

fixed #58
This commit is contained in:
Sugarme 2021-09-15 10:35:07 +10:00 committed by GitHub
commit 494f063642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -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]
- [#58] Fixed incorrect converting IValue from CIValue case 1 (Tensor).
## [Nofix]
- ctype `long` caused compiling error in MacOS as noted on [#44]. Not working on linux box.
@ -168,3 +169,4 @@ Same as [0.3.10]
[#44]: https://github.com/sugarme/gotch/issues/44
[#45]: https://github.com/sugarme/gotch/issues/45
[#48]: https://github.com/sugarme/gotch/issues/48
[#58]: https://github.com/sugarme/gotch/issues/58

View File

@ -162,7 +162,6 @@ func NewIValue(v interface{}) *IValue {
// ===============
func (iv *IValue) ToCIValue() (*CIValue, error) {
switch iv.name {
case "None":
cval := lib.AtiNone()
@ -451,7 +450,7 @@ func IValueFromC(cval *CIValue) (*IValue, error) {
return nil, err
}
return &IValue{
value: tensor,
value: Tensor{tensor},
kind: TensorVal,
name: "Tensor",
}, nil
@ -526,7 +525,7 @@ func IValueFromC(cval *CIValue) (*IValue, error) {
return nil, err
}
vals = append(vals, Tensor{v.Value().(lib.Ctensor)})
vals = append(vals, v.Value().(Tensor))
}
if len == 2 {
return &IValue{