function_go_proto

package
v1.12.2-0...-1b6f133 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionDef

type FunctionDef struct {
	// The definition of the function's name, arguments, return values,
	// attrs etc.
	Signature *op_def_go_proto.OpDef `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
	// Attributes specific to this function definition.
	Attr    map[string]*attr_value_go_proto.AttrValue `` /* 149-byte string literal not displayed */
	ArgAttr map[uint32]*FunctionDef_ArgAttrs          `` /* 171-byte string literal not displayed */
	// Unique IDs for each resource argument, used to track aliasing resources. If
	// Argument A and Argument B alias each other, then
	// resource_arg_unique_ids[A.index] == resource_arg_unique_ids[B.index].
	//
	// If this field is empty, none of the arguments could alias; otherwise, every
	// resource argument should have an entry in this field.
	//
	// When instantiated, the unique IDs will be attached to the _Arg nodes'
	// "_resource_arg_unique_id" attribute.
	ResourceArgUniqueId map[uint32]uint32 `` /* 212-byte string literal not displayed */
	// By convention, "op" in node_def is resolved by consulting with a
	// user-defined library first. If not resolved, "func" is assumed to
	// be a builtin op.
	NodeDef []*node_def_go_proto.NodeDef `protobuf:"bytes,3,rep,name=node_def,json=nodeDef,proto3" json:"node_def,omitempty"`
	// A mapping from the output arg names from `signature` to the
	// outputs from `node_def` that should be returned by the function.
	Ret map[string]string `` /* 147-byte string literal not displayed */
	// A mapping from control output names from `signature` to node names in
	// `node_def` which should be control outputs of this function.
	ControlRet           map[string]string `` /* 179-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

A function can be instantiated when the runtime can bind every attr with a value. When a GraphDef has a call to a function, it must have binding for every attr defined in the signature.

TODO(zhifengc):

  • device spec, etc.

func (*FunctionDef) Descriptor

func (*FunctionDef) Descriptor() ([]byte, []int)

func (*FunctionDef) GetArgAttr

func (m *FunctionDef) GetArgAttr() map[uint32]*FunctionDef_ArgAttrs

func (*FunctionDef) GetAttr

func (m *FunctionDef) GetAttr() map[string]*attr_value_go_proto.AttrValue

func (*FunctionDef) GetControlRet

func (m *FunctionDef) GetControlRet() map[string]string

func (*FunctionDef) GetNodeDef

func (m *FunctionDef) GetNodeDef() []*node_def_go_proto.NodeDef

func (*FunctionDef) GetResourceArgUniqueId

func (m *FunctionDef) GetResourceArgUniqueId() map[uint32]uint32

func (*FunctionDef) GetRet

func (m *FunctionDef) GetRet() map[string]string

func (*FunctionDef) GetSignature

func (m *FunctionDef) GetSignature() *op_def_go_proto.OpDef

func (*FunctionDef) ProtoMessage

func (*FunctionDef) ProtoMessage()

func (*FunctionDef) Reset

func (m *FunctionDef) Reset()

func (*FunctionDef) String

func (m *FunctionDef) String() string

func (*FunctionDef) XXX_DiscardUnknown

func (m *FunctionDef) XXX_DiscardUnknown()

func (*FunctionDef) XXX_Marshal

func (m *FunctionDef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FunctionDef) XXX_Merge

func (m *FunctionDef) XXX_Merge(src proto.Message)

func (*FunctionDef) XXX_Size

func (m *FunctionDef) XXX_Size() int

func (*FunctionDef) XXX_Unmarshal

func (m *FunctionDef) XXX_Unmarshal(b []byte) error

type FunctionDefLibrary

type FunctionDefLibrary struct {
	Function             []*FunctionDef `protobuf:"bytes,1,rep,name=function,proto3" json:"function,omitempty"`
	Gradient             []*GradientDef `protobuf:"bytes,2,rep,name=gradient,proto3" json:"gradient,omitempty"`
	XXX_NoUnkeyedLiteral struct{}       `json:"-"`
	XXX_unrecognized     []byte         `json:"-"`
	XXX_sizecache        int32          `json:"-"`
}

A library is a set of named functions.

func (*FunctionDefLibrary) Descriptor

func (*FunctionDefLibrary) Descriptor() ([]byte, []int)

func (*FunctionDefLibrary) GetFunction

func (m *FunctionDefLibrary) GetFunction() []*FunctionDef

func (*FunctionDefLibrary) GetGradient

func (m *FunctionDefLibrary) GetGradient() []*GradientDef

func (*FunctionDefLibrary) ProtoMessage

func (*FunctionDefLibrary) ProtoMessage()

func (*FunctionDefLibrary) Reset

func (m *FunctionDefLibrary) Reset()

func (*FunctionDefLibrary) String

func (m *FunctionDefLibrary) String() string

func (*FunctionDefLibrary) XXX_DiscardUnknown

func (m *FunctionDefLibrary) XXX_DiscardUnknown()

func (*FunctionDefLibrary) XXX_Marshal

func (m *FunctionDefLibrary) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FunctionDefLibrary) XXX_Merge

func (m *FunctionDefLibrary) XXX_Merge(src proto.Message)

func (*FunctionDefLibrary) XXX_Size

func (m *FunctionDefLibrary) XXX_Size() int

func (*FunctionDefLibrary) XXX_Unmarshal

func (m *FunctionDefLibrary) XXX_Unmarshal(b []byte) error

type FunctionDef_ArgAttrs

type FunctionDef_ArgAttrs struct {
	Attr                 map[string]*attr_value_go_proto.AttrValue `` /* 149-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}                                  `json:"-"`
	XXX_unrecognized     []byte                                    `json:"-"`
	XXX_sizecache        int32                                     `json:"-"`
}

Attributes for function arguments. These attributes are the same set of valid attributes as to _Arg nodes.

func (*FunctionDef_ArgAttrs) Descriptor

func (*FunctionDef_ArgAttrs) Descriptor() ([]byte, []int)

func (*FunctionDef_ArgAttrs) GetAttr

func (*FunctionDef_ArgAttrs) ProtoMessage

func (*FunctionDef_ArgAttrs) ProtoMessage()

func (*FunctionDef_ArgAttrs) Reset

func (m *FunctionDef_ArgAttrs) Reset()

func (*FunctionDef_ArgAttrs) String

func (m *FunctionDef_ArgAttrs) String() string

func (*FunctionDef_ArgAttrs) XXX_DiscardUnknown

func (m *FunctionDef_ArgAttrs) XXX_DiscardUnknown()

func (*FunctionDef_ArgAttrs) XXX_Marshal

func (m *FunctionDef_ArgAttrs) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*FunctionDef_ArgAttrs) XXX_Merge

func (m *FunctionDef_ArgAttrs) XXX_Merge(src proto.Message)

func (*FunctionDef_ArgAttrs) XXX_Size

func (m *FunctionDef_ArgAttrs) XXX_Size() int

func (*FunctionDef_ArgAttrs) XXX_Unmarshal

func (m *FunctionDef_ArgAttrs) XXX_Unmarshal(b []byte) error

type GradientDef

type GradientDef struct {
	FunctionName         string   `protobuf:"bytes,1,opt,name=function_name,json=functionName,proto3" json:"function_name,omitempty"`
	GradientFunc         string   `protobuf:"bytes,2,opt,name=gradient_func,json=gradientFunc,proto3" json:"gradient_func,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

GradientDef defines the gradient function of a function defined in a function library.

A gradient function g (specified by gradient_func) for a function f (specified by function_name) must follow the following:

The function 'f' must be a numerical function which takes N inputs and produces M outputs. Its gradient function 'g', which is a function taking N + M inputs and produces N outputs.

I.e. if we have

(y1, y2, ..., y_M) = f(x1, x2, ..., x_N),

then, g is

(dL/dx1, dL/dx2, ..., dL/dx_N) = g(x1, x2, ..., x_N,
                                  dL/dy1, dL/dy2, ..., dL/dy_M),

where L is a scalar-value function of (x1, x2, ..., xN) (e.g., the loss function). dL/dx_i is the partial derivative of L with respect to x_i.

func (*GradientDef) Descriptor

func (*GradientDef) Descriptor() ([]byte, []int)

func (*GradientDef) GetFunctionName

func (m *GradientDef) GetFunctionName() string

func (*GradientDef) GetGradientFunc

func (m *GradientDef) GetGradientFunc() string

func (*GradientDef) ProtoMessage

func (*GradientDef) ProtoMessage()

func (*GradientDef) Reset

func (m *GradientDef) Reset()

func (*GradientDef) String

func (m *GradientDef) String() string

func (*GradientDef) XXX_DiscardUnknown

func (m *GradientDef) XXX_DiscardUnknown()

func (*GradientDef) XXX_Marshal

func (m *GradientDef) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GradientDef) XXX_Merge

func (m *GradientDef) XXX_Merge(src proto.Message)

func (*GradientDef) XXX_Size

func (m *GradientDef) XXX_Size() int

func (*GradientDef) XXX_Unmarshal

func (m *GradientDef) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL