MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / generateFunctionForOp

Function generateFunctionForOp

tensorflow/go/genop/internal/genop.go:132–164  ·  view source on GitHub ↗
(w io.Writer, op *pb.OpDef, apidef *pb.ApiDef)

Source from the content-addressed store, hash-verified

130}
131
132func generateFunctionForOp(w io.Writer, op *pb.OpDef, apidef *pb.ApiDef) error {
133 if strings.HasPrefix(op.Name, "_") { // Internal operation
134 return nil
135 }
136 // Ignore operations where the Go types corresponding to the TensorFlow
137 // type haven't been worked out (such as "func"s).
138 for _, a := range op.Attr {
139 if _, err := goType(a.Type); err != nil {
140 return nil
141 }
142 }
143 // Also, haven't figured out reference types yet, so ignore those too.
144 for _, a := range op.InputArg {
145 if a.IsRef {
146 return nil
147 }
148 }
149 for _, a := range op.OutputArg {
150 if a.IsRef {
151 return nil
152 }
153 }
154 if apidef.Summary == "" {
155 // Undocumented operation, perhaps a sign of not being ready to
156 // export.
157 return nil
158 }
159 tmplArgs, err := newTmplArgs(op, apidef)
160 if err != nil {
161 return err
162 }
163 return tmplOp.Execute(w, tmplArgs)
164}
165
166var (
167 // Go keywords that cannot be used as identifiers.

Callers 2

generateFunctionsForOpsFunction · 0.85
TestGenerateOpFunction · 0.85

Calls 3

goTypeFunction · 0.85
newTmplArgsFunction · 0.85
ExecuteMethod · 0.45

Tested by 1

TestGenerateOpFunction · 0.68