New Features:
- The gradients supplied to argument
grads
of functioncg_function
can now also be matched by name (instead of positionally). The names associated with the gradients must match the non-constant arguments of the function provided to argumentdef
.
New Features:
- Added operator
cg_rowmeans
andcg_colmeans
.
Bug Fixes:
- Global symbols in the C-API are now correctly defined (fixes CRAN gcc10 error).
- Evaluating or differentiating a graph with operators having invalid inputs or invalid gradient functions no longer causes a segfault.
New Features:
- Added operator
cg_length
,cg_dim
,cg_nrow
, andcg_ncol
. - Added function
cg_graph_get
to retrieve a node by name from a graph. - Nodes can now be subsetted at run-time. Subsetting can be performed by calling the new operators
cg_subset1
orcg_subset2
, or the corresponding overloaded S3 methods[
and[[
respectively, on acg_node
object. - Function
cg_graph
has a new argumenteager
which can be used to enable or disable eager evaluation. Eager evaluation can also be enabled or disabled on an existing graph by changing data membereager
of acg_graph
object. - Function
cg_graph_forward
andcg_graph_backward
now allow argumenttarget
to be the name of the target node, in which case a linear search is performed to retrieve the node by name from the graph prior to a forward or backward pass. Please note that this search can be expensive for large graphs.
Comments:
- The name of a node no longer has to be unique.
- Function
cg_graph_run
andcg_graph_gradients
have been removed. - Data member
nodes
of acgraph
object is no longer named for performance reasons. Use functioncg_graph_get
to retrieve a node by name. - The performance of function
cg_operator
has significantly improved. Graphs can now be build considerbly faster.
Bug Fixes:
- Fixed a bug in function
cg_graph_backward
which sometimes caused a computational graph to be traversed in an incorrect order and compute incorrect gradients.
New Features:
- Added operator
cg_square
. - Operators are now evaluated eagerly. This means that, when an operator is added to a computational graph, it is immediately evaluated (if possible). Eager evaluation makes it easier to debug a computational graph and enables the user to change its control flow at run-time.
- Added function
cg_graph_forward
andcg_graph_backward
to perform a forward pass and backward pass respectively. These functions are similar to functioncg_graph_run
andcg_graph_gradients
but do not use environments to store the values and derivatives of nodes. Instead, the value and derivative of a node are stored 'locally' at each node and can be retrieved by data membervalue
andgrad
respectively.
Comments:
- Function
cg_graph_run
andcg_graph_gradients
are deprecated and will be removed in the next major release. Use functioncg_graph_forward
andcg_graph_backward
to perform a forward pass and backward pass instead.
Bug Fixes:
- Fixed several memory leaks and protection bugs.
Bug Fixes:
- Fixed several protection bugs in the C-API thanks to
rchk
.
New Features:
- Argument
index
of functioncg_graph_gradients
can now also beNULL
, in which case the nodes in a graph are differented element-wise. This is now also the default behavior.
Comments:
- The default name of a node is now
v
followed by the node id. - The S3 classes of the node types (i.e. constant, parameter, input, and operator) are removed for performance reasons. The type of a node can now be retrieved by data member
type
of acg_node
object.
Bug Fixes:
- Fixed memory leak in function
cg_graph_run
andcg_graph_gradients
. - Function
bsum
now prints a correct error message when argumentblock_size
is not a numerical scalar.
Bug Fixes:
- Fixed an bug that caused an error when installing
cgraph
on R versions before 3.5. - Function
cg_session_set_graph
no longer printsNULL
to the console when the active graph is changed. - Operator
cg_sigmoid
now works correctly when argumentx
is a logical or integer vector or array.
Comments:
- The C-API has been completely reworked.
- Operators
cg_reshape
,!
,==
,!=
,<
,>
,<=
, and>=
are removed. - R6 class
cgraph
is removed. Use functioncg_graph
to create a new graph. The active graph can now be retrieved and changed by functioncg_session_graph
andcg_session_set_graph
respectively. - Function
const
,input
,parm
, andopr
have been renamed tocg_constant
,cg_input
,cg_parameter
, andcg_operator
respectively. - Function
val
andset
are removed. The value of a constant or parameter can now be retrieved or changed by data membervalue
of acg_node
object. - Function
run
andgradients
have been renamed tocg_graph_run
andcg_graph_gradients
respectively.
New Features:
- The function that is called by an operator is no longer stored as a symbol in the environment of the operator. Instead, each function now has its own global
cg_function
object which can be linked to an operator. This significantly reduces the size of acg_graph
object.
Bug Fixes:
- Fixed a bug that caused a node to be evaluated to its corresponding
cg_node
environment rather than its value when callingcg_graph_run
andcg_graph_gradients
. - Fixed a bug that caused a segfault when calling function
cg_graph_run
andcg_graph_gradients
on acg_graph
object which contains nodes with an invalid id.
Bug Fixes:
- Fixed a bug that caused overloaded S3 methods called by operators to dispatch incorrectly on R versions before 3.5.
Comments:
- Large parts of the C-API have been reworked.
- Some naming conventions have changed. Individual names in the name of a function are now separated with an underscore (_) instead of a dot (.). For example, operator
cg.matmul
is now namedcg_matmul
. The same rule applies to class names. For example, classcg.node
is now namedcg_node
. - Function
name
is removed. Names for nodes are now generated internally in the C-API. - Function
approx.gradients
is no longer exported but still avaiable in the package namespace. Please note that this function is not well-optimized and should only be used for testing purposes. - Calling
print
on acg_node
object no longer prints the value of the node. Use functionval
to evaluate a node.
New Features:
- The initialization method of a cgraph object has a new argument
library
which can be used to specify the function library that is used by the graph. - The calls of functions and their corresponding gradient functions are now build at run-time.
- Added function
val
andset
to retrieve or set the value of a node respectively. - A node can now also be named 'grad'. 'grad' is no longer a reserved word.
- Operator
cg_mean
now calls the basemean
function. - Operator
cg_crossprod
andcg_tcrossprod
now allow argumenty
to be missing (similarly as the corresponding base functions). - Argument
dim
of operatorcg_reshape
now expects ancg_node
object instead of an integer scalar or vector that holds the new array dimensions.
Bug Fixes:
- Fixed a bug that caused a segfault when using cgraph in RStudio on Red Hat Enterprise Linux.
Comments:
- The S3 overloaded methods of prefix operators have been marked as deprecated and will be removed in the next major release. Only infix operators like
+
or-
will have S3 overloaded methods.
Bug Fixes:
- Operator
sigmoid
now correctly handles numerical underflow. - Operator
cg.pmax
andcg.pmin
are now correctly differentiated when argumentx
andy
are arrays.
New Features:
- Added logical operators
!
,==
,!=
,<
,>
,<=
, and>=
.
Bug Fixes:
- Nodes that are given a value upon creation are now properly printed to the R console.
- Function
run
,gradients
, andapprox.grad
no longer cause an infinite loop when membervalues
of acgraph
object is supplied to thevalues
argument of the functions. - Fixed protection bug in function
gradients
which caused the R session to crash unexpectedly. - Function
approx.grad
now checks whether nodex
andy
evaluate to a numeric vector or array. - Function
approx.grad
no longer changes the parent environment of argumentvalues
when the argument is an environment.
Bug Fixes:
- Function
run
andgradients
no longer change the parent environment of argumentvalues
when the argument is an environment. - Function
name
no longer generates a name that indicates the node type for performance reasons. Instead, it simply generates the name 'node' followed by the number of nodes that have been added to the graph. - Fixed several protection bugs in the C-API thanks to
rchk
.
Comments:
- The license of the package has changed from GPL-3 to Apache License 2.0.
New Features:
- Added hyperbolic trigonometry operations
sinh
andcosh
. - Added inverse hyperbolic trigonometry operations
asinh
andacosh
. - Data member
nodes
of acgraph
object is now named to allow more convenient access to the symbols of the nodes in a graph. - You can now instruct the active graph to no longer automatically evaluate a node when it is printed to the console by setting
options(cg.autorun = FALSE)
.
Bug Fixes:
- An error is now raised when an invalid object is provided to the methods of a
cgraph
object instead of coercing the object to a valid object. - Function
opr
now ignores argumentgrads
when its elements are not properly named. - Function
run
now checks whether each node evaluates to a numeric vector or array. - Function
gradients
now checks whether the node supplied to argumentname
evaluates to a numeric vector or array. - Function
get.parms
andadd.parms
now correctly call the underlying C-API.
Comments:
- CRAN Review on the cgraph 1.0.0 submission.
Comments:
- Initial CRAN Submission.