Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding new unit test to inference activity #315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions activity/inference/activity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,50 @@ func TestDNNEstimator(t *testing.T) {
}
}

func TestDNNEstimatorNumpy(t *testing.T) {
defer func() {
if r := recover(); r != nil {
t.Failed()
t.Errorf("panic during execution: %v", r)
}
}()

act := NewActivity(getActivityMetadata())
tc := test.NewTestActivityContext(getActivityMetadata())

var done bool
var err error

// Unit test of Estimator DNN Regressor model
fmt.Println("Unit test of Estimator Regressor model")
tc.SetInput("model", "testModels/Archive_estDNNrgr.zip")
tc.SetInput("inputName", "inputs")
var estInputs = make(map[string]interface{})
estInputs["one"] = 0.140586
estInputs["two"] = 0.140586
estInputs["three"] = 0.140586
estInputs["label"] = 0.

var features []interface{}
features = append(features, map[string]interface{}{
"name": "inputs",
"data": estInputs,
})

tc.SetInput("inputName", "inputs")
tc.SetInput("framework", "Tensorflow")
tc.SetInput("sigDefName", "serving_default")
tc.SetInput("tag", "serve")
tc.SetInput("features", features)

done, err = act.Eval(tc)
if done == false {
assert.Fail(t, fmt.Sprintf("Error raised: %s", err))
} else {
assert.True(t, done, fmt.Sprintf("Evaluation came back: %t", done))
}
}

func TestEstimatorLinearRegressor(t *testing.T) {
defer func() {
if r := recover(); r != nil {
Expand Down
Binary file not shown.