Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
389fbb5c
Commit
389fbb5c
authored
Feb 06, 2019
by
Siva
Committed by
Tianqi Chen
Feb 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Golang] bugfix #2517 (#2558)
parent
7c124950
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
golang/src/function_test.go
+1
-1
golang/src/ndarray.go
+4
-4
golang/src/value.go
+2
-2
No files found.
golang/src/function_test.go
View file @
389fbb5c
...
@@ -204,7 +204,7 @@ func TestFunctionClosureArg(t *testing.T) {
...
@@ -204,7 +204,7 @@ func TestFunctionClosureArg(t *testing.T) {
return
return
}
}
if
ret1
.
AsInt64
()
!=
ret
.
AsInt64
()
{
if
ret1
.
AsInt64
()
!=
ret
.
AsInt64
()
{
err
=
fmt
.
Errorf
(
"Invoke with int64 didn't match with Value
\n
"
)
err
=
fmt
.
Errorf
(
"Invoke with int64 didn't match with Value"
)
return
return
}
}
retVal
=
ret
retVal
=
ret
...
...
golang/src/ndarray.go
View file @
389fbb5c
...
@@ -101,7 +101,7 @@ func (parray Array) CopyFrom(val interface{}) (err error) {
...
@@ -101,7 +101,7 @@ func (parray Array) CopyFrom(val interface{}) (err error) {
datalen
=
len
(
sliceVal
)
*
int
(
dtype
.
bits
/
8
)
datalen
=
len
(
sliceVal
)
*
int
(
dtype
.
bits
/
8
)
return
parray
.
nativeCopyFrom
(
data
,
datalen
)
return
parray
.
nativeCopyFrom
(
data
,
datalen
)
default
:
default
:
err
=
fmt
.
Errorf
(
"Given type not supported : %v
\n
"
,
reflect
.
TypeOf
(
val
))
err
=
fmt
.
Errorf
(
"Given type not supported : %v"
,
reflect
.
TypeOf
(
val
))
return
return
}
}
return
return
...
@@ -195,7 +195,7 @@ func (parray Array) AsSlice() (retVal interface{}, err error) {
...
@@ -195,7 +195,7 @@ func (parray Array) AsSlice() (retVal interface{}, err error) {
err
=
parray
.
nativeCopyTo
(
data
,
datalen
)
err
=
parray
.
nativeCopyTo
(
data
,
datalen
)
retVal
=
sliceVal
retVal
=
sliceVal
default
:
default
:
err
=
fmt
.
Errorf
(
"Given type not supported : %v
\n
"
,
parray
.
GetDType
())
err
=
fmt
.
Errorf
(
"Given type not supported : %v"
,
parray
.
GetDType
())
return
return
}
}
return
return
...
@@ -279,7 +279,7 @@ func Empty(shape []int64, args ...interface{}) (parray *Array, err error) {
...
@@ -279,7 +279,7 @@ func Empty(shape []int64, args ...interface{}) (parray *Array, err error) {
ctx
:=
Context
{
KDLCPU
,
0
}
ctx
:=
Context
{
KDLCPU
,
0
}
if
len
(
shape
)
<
1
{
if
len
(
shape
)
<
1
{
err
=
fmt
.
Errorf
(
"Invalid shape for Array creation: %v
\n
"
,
len
(
shape
))
err
=
fmt
.
Errorf
(
"Invalid shape for Array creation: %v"
,
len
(
shape
))
return
return
}
}
...
@@ -290,7 +290,7 @@ func Empty(shape []int64, args ...interface{}) (parray *Array, err error) {
...
@@ -290,7 +290,7 @@ func Empty(shape []int64, args ...interface{}) (parray *Array, err error) {
case
Context
:
case
Context
:
ctx
=
args
[
i
]
.
(
Context
)
ctx
=
args
[
i
]
.
(
Context
)
default
:
default
:
err
=
fmt
.
Errorf
(
"Invalid Optional Argument Type: %T
\n
"
,
val
)
err
=
fmt
.
Errorf
(
"Invalid Optional Argument Type: %T"
,
val
)
return
return
}
}
}
}
...
...
golang/src/value.go
View file @
389fbb5c
...
@@ -307,7 +307,7 @@ func (tvmval *Value) setValue(val interface{}) (retVal int32, err error) {
...
@@ -307,7 +307,7 @@ func (tvmval *Value) setValue(val interface{}) (retVal int32, err error) {
case
func
(
args
...*
Value
)
(
interface
{},
error
)
:
case
func
(
args
...*
Value
)
(
interface
{},
error
)
:
fhandle
,
apierr
:=
ConvertFunction
(
val
)
fhandle
,
apierr
:=
ConvertFunction
(
val
)
if
apierr
!=
nil
{
if
apierr
!=
nil
{
err
=
fmt
.
Errorf
(
"Given value Type not defined for Value: %v : %T
\n
"
,
val
,
val
);
err
=
fmt
.
Errorf
(
"Given value Type not defined for Value: %v : %T"
,
val
,
val
);
return
return
}
}
tvmval
.
setVFHandle
(
*
fhandle
)
tvmval
.
setVFHandle
(
*
fhandle
)
...
@@ -320,7 +320,7 @@ func (tvmval *Value) setValue(val interface{}) (retVal int32, err error) {
...
@@ -320,7 +320,7 @@ func (tvmval *Value) setValue(val interface{}) (retVal int32, err error) {
fromval
:=
val
.
(
Value
)
fromval
:=
val
.
(
Value
)
tvmval
.
moveFrom
(
&
fromval
)
tvmval
.
moveFrom
(
&
fromval
)
default
:
default
:
err
=
fmt
.
Errorf
(
"Given value Type not defined for Value: %v : %T
\n
"
,
val
,
val
);
err
=
fmt
.
Errorf
(
"Given value Type not defined for Value: %v : %T"
,
val
,
val
);
}
}
retVal
=
tvmval
.
dtype
retVal
=
tvmval
.
dtype
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment