Module Operator.Symbol

Core functions
val op_to_str : Shape.Type.op -> string

return the name of the operator as string

val is_random_variable : Shape.Type.op -> bool

check if operator is randon variable

val refnum : 'a Owl_graph.node -> int

return the reference number of the given node

val node_shape : Shape.Type.attr Owl_graph.node -> int array

return the shape of a node

val node_numel : Shape.Type.attr Owl_graph.node -> int

return the number of elements of a node

val is_shape_unknown : Shape.Type.attr Owl_graph.node -> bool

check if the shape of the input node is unknown

val infer_shape_graph : Shape.Type.attr Owl_graph.node array -> unit

automatically infer the shape of input node according to its descendents' shapes

val shape_to_str : int array option array -> string

helper function; return the input array in string format.

val node_to_str : Shape.Type.attr Owl_graph.node -> string

print node's information to string

val node_to_arr : Shape.Type.t -> Shape.Type.arr

Wrap computation graph node in an array type

val arr_to_node : Shape.Type.arr -> Shape.Type.t

Unwrap the array type to get the computation graph node within

val node_to_elt : Shape.Type.t -> Shape.Type.elt

Wrap computation graph node in an Elt type

val elt_to_node : Shape.Type.elt -> Shape.Type.t

Unwrap the Elt type to get the computation graph node within

val make_node : ?name:string -> ?value:Shape.Type.Device.value array -> ?shape:int array option array -> ?freeze:bool -> ?reuse:bool -> ?state:Shape.Type.state -> Shape.Type.op -> Shape.Type.attr Owl_graph.node

crate a computation graph node

val make_then_connect : ?shape:int array option array -> Shape.Type.op -> Shape.Type.attr Owl_graph.node array -> Shape.Type.attr Owl_graph.node

make nodes and then connect parents and children

val var_arr : ?shape:int array -> string -> Shape.Type.arr

creat a node and wrap in Arr type

val var_elt : string -> Shape.Type.elt

creat a node and wrap in Elt type

val const_arr : string -> Shape.Type.Device.A.arr -> Shape.Type.arr

get ndarray value from input and create an node and wrap in Arr type

val const_elt : string -> Shape.Type.Device.A.elt -> Shape.Type.elt

get value from input and create an node and wrap in Elt type

val new_block_id : unit -> int

new_block_id () returns an unused block id.

val make_empty_block : ?block_id:int -> int -> Shape.Type.block

make_empty_block s returns an empty block of memory of size s.

val make_value_block : Shape.Type.Device.value -> Shape.Type.attr Owl_graph.node -> unit

make_value_block value node creates a block of memory initialised with value and links the new block to node.

get_block node returns the memory block allocated to node. If no block is allocated, throws an exception.

val add_node_to_block : Shape.Type.attr Owl_graph.node -> Shape.Type.block -> unit

Link a node to a reusable block and initialises its memory on the memory of the block.

val get_active_node : Shape.Type.block -> Shape.Type.attr Owl_graph.node option

Return the node that is currently using the memory of the block.

val set_active_node : Shape.Type.block -> Shape.Type.attr Owl_graph.node -> unit

Update the node that is currently using the block of memory.

val get_block_id : Shape.Type.attr Owl_graph.node -> int

get_block_id node returns the id of the block assigned to node. If node has not been assigned yet, returns -1.

val set_value : Shape.Type.attr Owl_graph.node -> Shape.Type.Device.value array -> unit

set the arrays of value to cgraph node

get the arrays of value of cgraph node

val set_operator : Shape.Type.attr Owl_graph.node -> Shape.Type.op -> unit

set the operator of cgraph node

get the operator of cgraph node

val set_reuse : Shape.Type.attr Owl_graph.node -> bool -> unit

set reuse attribute in a node

val get_reuse : Shape.Type.attr Owl_graph.node -> bool

get reuse attribute in a node

val is_shared : Shape.Type.attr Owl_graph.node -> bool

check of the data block of memory is shared in a node

get_shared_nodes node returns the nodes sharing the same block of memory as node.

val is_var : Shape.Type.attr Owl_graph.node -> bool

check if the node's operator is Var type

val is_const : Shape.Type.attr Owl_graph.node -> bool

check if the node's operator is Const type

val is_node_arr : Shape.Type.attr Owl_graph.node -> bool

check the shape of a node's attr and return if it indicates an ndarray

val is_node_elt : Shape.Type.attr Owl_graph.node -> bool

check the shape of a node's attr and return if it indicates an elt

val is_assigned : Shape.Type.attr Owl_graph.node -> bool

is_assigned node checks if a block of memory has been assigned to node.

val check_assigned : Shape.Type.attr Owl_graph.node -> unit

check_assigned node throws an exception if node has not been assigned to a block.

val is_valid : Shape.Type.attr Owl_graph.node -> bool

check if the state attribute of a node is Valid

val validate : Shape.Type.attr Owl_graph.node -> unit

set Valid to the state attribute of a node

val invalidate : Shape.Type.attr Owl_graph.node -> unit

set Invalid to the state attribute of a node

val invalidate_graph : Shape.Type.attr Owl_graph.node -> unit

iteratively invalidate the nodes in a graph

val is_freeze : Shape.Type.attr Owl_graph.node -> bool

check the freeze attribute of a node

val freeze : Shape.Type.attr Owl_graph.node -> unit

return the freeze attribute of a node

val freeze_descendants : Shape.Type.attr Owl_graph.node array -> unit

iteratively freeze the descendants of a node

val freeze_ancestors : Shape.Type.attr Owl_graph.node array -> unit

iteratively freeze the ancestors of a node

pack an A.arr type input into Arr type

unpack input into A.arr type

pack an A.elt type input into Elt type

unpack input into A.elt type

val unsafe_assign_arr : Shape.Type.arr -> Shape.Type.Device.A.arr -> unit

assign Arr type value

val assign_arr : Shape.Type.arr -> Shape.Type.Device.A.arr -> unit

assign Arr type value

val assign_elt : Shape.Type.elt -> Shape.Type.Device.A.elt -> unit

assign Elt type value

val float_to_elt : float -> Shape.Type.elt

build an Elt type based on float value

val elt_to_float : Shape.Type.elt -> float

retrive a float value from an Elt type value