MCPcopy Create free account
hub / github.com/sql-machine-learning/sqlflow / TFLoadAndPredict

Function TFLoadAndPredict

go/codegen/pai/tensorflow.go:78–99  ·  view source on GitHub ↗

TFLoadAndPredict generates PAI-TF prediction program.

(ir *ir.PredictStmt, session *pb.Session, modelPath string)

Source from the content-addressed store, hash-verified

76
77// TFLoadAndPredict generates PAI-TF prediction program.
78func TFLoadAndPredict(ir *ir.PredictStmt, session *pb.Session, modelPath string) (string, error) {
79 var tpl = template.Must(template.New("Predict").Parse(tfPredictTmplText))
80 ossModelDir := OSSModelURL(modelPath)
81 paiPredictTable := ""
82 if tensorflow.IsPAI() && ir.TmpPredictTable != "" {
83 paiPredictTable = ir.TmpPredictTable
84 }
85 filler := predictFiller{
86 OSSModelDir: ossModelDir,
87 DataSource: session.DbConnStr,
88 Select: ir.Select,
89 ResultTable: ir.ResultTable,
90 ResultColumn: ir.ResultColumn,
91 PAITable: paiPredictTable,
92 Using: ir.Using,
93 }
94 var code bytes.Buffer
95 if err := tpl.Execute(&code, filler); err != nil {
96 return "", err
97 }
98 return code.String(), nil
99}
100
101// TFLoadAndExplain generates PAI-TF explain program.
102func TFLoadAndExplain(ir *ir.ExplainStmt, session *pb.Session, modelPath string, expn *ExplainRender) (string, error) {

Callers 1

PredictFunction · 0.85

Calls 4

IsPAIFunction · 0.92
OSSModelURLFunction · 0.85
ParseMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected