forked from buckhx/gobert
/
estimator.go
43 lines (35 loc) · 942 Bytes
/
estimator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Package estimator is a utility method for interacting with tf models.
// *** Experimental ***
// This package is meant ot be a pseudo-port of the python Estimator API
package estimator
import (
tf "github.com/tensorflow/tensorflow/tensorflow/go"
)
// InputFunc matches feeds in sessions
type InputFunc func(m *tf.SavedModel) map[tf.Output]*tf.Tensor
// ModelFunc the returned params match fetches & targets from the API
type ModelFunc func(m *tf.SavedModel) ([]tf.Output, []*tf.Operation)
// Estimator matches the tf, p
type Estimator interface {
/*
Trainer
Evaluator
Exporter
*/
Predictor
}
// Predictor creates tensors for prediction
type Predictor interface {
Predict(InputFunc) ([]*tf.Tensor, error)
}
/*
type Evaluator interface {
Evaluate(InputFunc) ([]*tf.Tensor, error)
}
type Trainer interface {
Train(InputFunc) ([]*tf.Tensor, error)
}
type Exporter interface {
Export(InputFunc) ([]*tf.Tensor, error)
}
*/