optimizer_test.go 1.0 KB
Newer Older
D
dongzhihong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.

// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0

// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

H
Helin Wang 已提交
15 16
package pserver

D
dongzhihong 已提交
17 18 19 20
import (
	"io/ioutil"
	"testing"
)
H
Helin Wang 已提交
21

D
dongzhihong 已提交
22 23 24
func TestOptimizerCreateRelease(t *testing.T) {
	p := Parameter{
		Name:        "a",
D
dongzhihong 已提交
25
		ElementType: Int32,
D
dzhwinter 已提交
26
	}
D
dongzhihong 已提交
27
	p.Content = []byte{1, 3}
Q
Qiao Longfei 已提交
28
	config, err := ioutil.ReadFile("./client/c/test/testdata/optimizer.pb")
D
dongzhihong 已提交
29 30 31
	if err != nil {
		t.Fatalf("read optimizer proto failed")
	}
D
dongzhihong 已提交
32 33 34 35
	param := ParameterWithConfig{
		Param:  p,
		Config: config,
	}
D
dongzhihong 已提交
36
	o := newOptimizer(param, nil)
H
Helin Wang 已提交
37 38
	o.Cleanup()
}