MCPcopy Create free account
hub / github.com/CodingBeard/tfkg / GetModelWeights

Method GetModelWeights

model/model.go:279–301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

277}
278
279func (m *TfkgModel) GetModelWeights() ([]*tf.Tensor, error) {
280 var variableOutputs []tf.Output
281
282 for _, l := range m.layers {
283 for _, operation := range m.model.Graph.Operations() {
284 if strings.HasPrefix(operation.Name(), l.GetName()) && operation.Type() == "ReadVariableOp" {
285 variableOutputs = append(variableOutputs, m.model.Graph.Operation(operation.Name()).Output(0))
286 }
287 }
288 }
289
290 results, e := m.model.Session.Run(
291 map[tf.Output]*tf.Tensor{},
292 variableOutputs,
293 nil,
294 )
295 if e != nil {
296 m.errorHandler.Error(e)
297 return nil, e
298 }
299
300 return results, nil
301}
302
303func (m *TfkgModel) GetLayerWeights(layerName string) ([]*tf.Tensor, error) {
304 var variableOutputs []tf.Output

Callers

nothing calls this directly

Calls 2

GetNameMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected