TurboWarp: https://turbowarp.org/1381303043 This demo demonstrates how a neural network can learn the sine function. The demo converges in about 40 steps. AutoGrad.sb3 is a general-purpose automatic differentiation library designed for extensibility and high performance. Here is how to use it. autogr:reset * Initializes the entire system. autogr:tensor | n name random * Creates a tensor with n elements and assigns it the specified name. * If random is set to 1, the tensor is initialized with random values. autogr:set_tensor_value_from_buffer | name * Sets the values of the tensor named name to the contents of autogr:buffer. * The contents of autogr:buffer are cleared afterward. autogr:get_tensor_value_to_buffer | name * Copies the values of the tensor named name into autogr:buffer. autogr:push_children | name * Used with autogr:tensor_concat. * Selects the tensors to be concatenated by autogr:tensor_concat. autogr:tensor_* | a b arg1 arg2 result * Performs an operation using a and b, or only a, depending on the operation. * a, b, and result refer to the names assigned when the tensors were created. * The result of the operation is stored in result. autogr:backward | name * Treats the gradient of the tensor named name as 1, then computes the gradients of name and all of its child tensors. autogr:reset_grad | name reset_leaf * Resets the gradients of the tensor named name and all of its child tensors to 0. * If reset_leaf is set to 1, the gradients of leaf tensors (tensors that are not intermediate results of operations) are also reset to 0. autogr:free * Frees the tensors. autogr:apply_grad | name rate * Adds gradient * rate to the values of the tensor named name. Functions whose names begin with autogr* are internal functions. To define a new operation: 1. Define autogr:tensor_op_name and copy the implementation from another similar function. 2. Add op_name to name in autogr*tensor_calc_part1. 3. Define how gradients are propagated for the new operation in autogr:backward.