Documentation ¶
Index ¶
- func SaveFile(graphDef *Def, filename string) error
- type Def
- func (g *Def) Append(graphDef *Def) error
- func (g *Def) ApplyPrefix(prefix string) error
- func (g *Def) DeleteNode(nodeName string)
- func (g *Def) DeleteNodes(nodeNames ...string) error
- func (g *Def) Export(prefix string) (*tf.Graph, error)
- func (g *Def) GetNode(nodeName string) (*node.Def, error)
- func (g *Def) GetNodes(nodeNames ...string) ([]*node.Def, error)
- func (g *Def) Import(graph *tf.Graph) error
- func (g *Def) ListNodes(options ...ListNodesOption) []string
- func (g *Def) MarshalJSON() ([]byte, error)
- func (g *Def) PrintDotNotation() ([]byte, error)
- func (g *Def) ProtoReflect() protoreflect.Message
- func (g *Def) RenameNode(name, newName string) error
- func (g *Def) Reset()
- func (g *Def) SetNodes(nodeDefs ...*node.Def)
- func (g *Def) String() string
- func (g *Def) UnmarshalJSON(data []byte) error
- type ListNodesOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Def ¶
type Def struct {
// contains filtered or unexported fields
}
Def wraps proto definition of graphdef to define a few utility methods on it
func LoadFile ¶
LoadFile imports graph from a file formatted as either binary protobuf, protobuf text or json
func (*Def) Append ¶
Append appends input graphDef to the receiver thereby growing the node pool of receiver graph
func (*Def) ApplyPrefix ¶
ApplyPrefix applies input prefix to all node names and also changes the input strings where these nodes are being referred to
func (*Def) DeleteNode ¶
DeleteNode deletes a node from the graph
func (*Def) DeleteNodes ¶
DeleteNodes deletes provided node names if they exist
func (*Def) GetNode ¶
GetNode returns a node.Def. Each graph is essentially just a list of nodes and links between nodes is defined via node inputs
func (*Def) GetNodes ¶
GetNodes returns list of nodes based on input names. Input names should only contain names present in the graph, otherwise an error is returned
func (*Def) Import ¶
Import converts tensorflow Graph format to Def. In some ways tensorflow Graph can be thought of as higher level construct and Def allows looking into nodes and attributes at a raw level
func (*Def) ListNodes ¶
func (g *Def) ListNodes(options ...ListNodesOption) []string
ListNodes returns node names and filters them via options. Options are function literals that answer bool on each node. Thus, each option, if any is provided, should be satisfied
func (*Def) MarshalJSON ¶
MarshalJSON defines how receiver can be json marshaled
func (*Def) PrintDotNotation ¶
PrintDotNotation defines how receiver can be printed as a dot notation for visualization via graphviz https://graphviz.org/doc/info/lang.html
func (*Def) ProtoReflect ¶
func (g *Def) ProtoReflect() protoreflect.Message
ProtoReflect defines how receiver can be proto marshaled and unmarshaled
func (*Def) RenameNode ¶
RenameNode only changes the name of a particular node if it exists without affecting the inputs where such node name is being referred. newName should not collide with an existing name
func (*Def) SetNodes ¶
SetNodes will overwrite nodes in the graph with same name or append to graph if the name is not found
func (*Def) UnmarshalJSON ¶
UnmarshalJSON defines how receiver can be json unmarshaled
type ListNodesOption ¶
ListNodesOption is a func that answers yes/no on a node. Such options can be provided to filter node list
func ListNodesOptionOp ¶
func ListNodesOptionOp(op string) ListNodesOption
ListNodesOptionOp takes op as a string and checks if node op matches it
func ListNodesOptionWithInputs ¶
func ListNodesOptionWithInputs(inputs ...string) ListNodesOption
ListNodesOptionWithInputs checks if each of the inputs for a node matches one from the input