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

Function TFLoadAndExplain

go/codegen/pai/tensorflow.go:102–129  ·  view source on GitHub ↗

TFLoadAndExplain generates PAI-TF explain program.

(ir *ir.ExplainStmt, session *pb.Session, modelPath string, expn *ExplainRender)

Source from the content-addressed store, hash-verified

100
101// TFLoadAndExplain generates PAI-TF explain program.
102func TFLoadAndExplain(ir *ir.ExplainStmt, session *pb.Session, modelPath string, expn *ExplainRender) (string, error) {
103 var tpl = template.Must(template.New("Explain").Parse(tfExplainTmplText))
104 ossModelDir := OSSModelURL(modelPath)
105 paiExplainTable := ""
106 if tensorflow.IsPAI() && ir.TmpExplainTable != "" {
107 paiExplainTable = ir.TmpExplainTable
108 }
109 filler := explainFiller{
110 OSSModelDir: ossModelDir,
111 DataSource: session.DbConnStr,
112 Select: ir.Select,
113 ResultTable: ir.Into,
114 IsPAI: tensorflow.IsPAI(),
115 PAITable: paiExplainTable,
116 // TODO(weiguo): use GFile to write oss without ak/sk
117 // ref: https://yuque.antfin-inc.com/pai-user/manual/tf_oss_by_gfile
118 ResultOSSDest: expn.key,
119 ResultOSSAK: expn.ak,
120 ResultOSSSK: expn.sk,
121 ResultOSSEndpoint: expn.endpoint,
122 ResultOSSBucket: expn.bucket,
123 }
124 var code bytes.Buffer
125 if err := tpl.Execute(&code, filler); err != nil {
126 return "", err
127 }
128 return code.String(), nil
129}
130
131// TFLoadAndEvaluate generates PAI-TF evaluate program.
132func TFLoadAndEvaluate(ir *ir.EvaluateStmt, session *pb.Session, modelPath string) (string, error) {

Callers 1

ExplainFunction · 0.85

Calls 4

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

Tested by

no test coverage detected