提交 eaed87b0 编写于 作者: D dzhwinter

"fix optimizer include error"

上级 cc487c09
...@@ -10,5 +10,6 @@ include(golang) ...@@ -10,5 +10,6 @@ include(golang)
include(flags) include(flags)
go_library(paddle_pserver_cclient STATIC) go_library(paddle_pserver_cclient STATIC)
if(WITH_TESTING)
add_subdirectory(test) add_subdirectory(test)
endif()
package pserver package pserver
/* /*
#cgo CFLAGS: -I ../../
#include "paddle/optimizer/optimizer.h" #include "paddle/optimizer/optimizer.h"
*/ */
import "C" import "C"
......
...@@ -3,6 +3,12 @@ package pserver ...@@ -3,6 +3,12 @@ package pserver
import "testing" import "testing"
func TestSGDCreateRelease(t *testing.T) { func TestSGDCreateRelease(t *testing.T) {
param := pserver.ParameterWithConfig{
Param : pserver.Parameter{Name : "a",
ElementType: ,
Content: ,
Length : }
}
o := newOptimizer(sgd, 1) o := newOptimizer(sgd, 1)
o.Cleanup() o.Cleanup()
} }
...@@ -13,7 +13,9 @@ func TestFull(t *testing.T) { ...@@ -13,7 +13,9 @@ func TestFull(t *testing.T) {
s := pserver.NewService() s := pserver.NewService()
var p pserver.Parameter var p pserver.Parameter
p.Name = "param_a" p.Name = "param_a"
p.Content = []byte{1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0} ElementValue := []byte{1, 0, 0, 0, 2, 0, 0, 0, 3, 0, 0, 0}
p.Content = &ElementValue[0]
p.Length = len(ElementValue)
p.ElementType = pserver.Int32 p.ElementType = pserver.Int32
err := s.InitParam(pserver.ParameterWithConfig{Param: p, Config: nil}, nil) err := s.InitParam(pserver.ParameterWithConfig{Param: p, Config: nil}, nil)
if err != nil { if err != nil {
...@@ -22,7 +24,9 @@ func TestFull(t *testing.T) { ...@@ -22,7 +24,9 @@ func TestFull(t *testing.T) {
var p1 pserver.Parameter var p1 pserver.Parameter
p1.Name = "param_b" p1.Name = "param_b"
p1.Content = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ElementValue = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
p1.Content = &ElementValue[0]
p1.Length = len(ElementValue)
p1.ElementType = pserver.Float32 p1.ElementType = pserver.Float32
err = s.InitParam(pserver.ParameterWithConfig{Param: p1, Config: nil}, nil) err = s.InitParam(pserver.ParameterWithConfig{Param: p1, Config: nil}, nil)
if err != nil { if err != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册