AddOperation adds the operation to the Graph managed by s. If there is a name prefix associated with s (such as if s was created by a call to SubScope), then this prefix will be applied to the name of the operation being added. See also Graph.AddOperation.
(args tf.OpSpec)
| 73 | // by a call to SubScope), then this prefix will be applied to the name |
| 74 | // of the operation being added. See also Graph.AddOperation. |
| 75 | func (s *Scope) AddOperation(args tf.OpSpec) *tf.Operation { |
| 76 | if s.Err() != nil { |
| 77 | return nil |
| 78 | } |
| 79 | if args.Name == "" { |
| 80 | args.Name = args.Type |
| 81 | } |
| 82 | if s.namespace != "" { |
| 83 | args.Name = s.namespace + "/" + args.Name |
| 84 | } |
| 85 | args.ControlDependencies = append(args.ControlDependencies, s.controlDependencies...) |
| 86 | args.Device = s.device |
| 87 | op, err := s.graph.AddOperation(args) |
| 88 | if err != nil { |
| 89 | s.UpdateErr(args.Type, err) |
| 90 | } |
| 91 | return op |
| 92 | } |
| 93 | |
| 94 | // SubScope returns a new Scope which will cause all operations added to the |
| 95 | // graph to be namespaced with 'namespace'. If namespace collides with an |
no test coverage detected