<commit_before>import autograd.core as core
from autograd import grad
import autograd.numpy as np
import numpy as onp

## SHORT FUNCTION
def f_short(x):
    return x**2

def time_short_forward_pass():
    core.forward_pass(f_short, (2.,), {})

short_start_node, short_end_node = core.forward_pass(f_short, (2.,), {})

def time_short_backward_pass():
    core.backward_pass(1., short_end_node, short_start_node)

def time_short_grad():
    grad(f_short)(2.)

## LONG FUNCTION
def f_long(x):
    for i in range(50):
        x = np.sin(x)
    return x

def time_long_forward_pass():
    core.forward_pass(f_long, (2.,), {})

long_start_node, long_end_node = core.forward_pass(f_long, (2.,), {})

def time_long_backward_pass():
    core.backward_pass(1., long_end_node, long_start_node)

def time_long_grad():
    grad(f_long)(2.)

## 'PEARLMUTTER TEST' FUNCTION
def fan_out_fan_in(x):
    for i in range(10**4):
        x = (x + x)/2.0
    return np.sum(x)

def time_fan_out_fan_in_forward_pass():
    core.forward_pass(fan_out_fan_in, (2.,), {})

fan_start_node, fan_end_node = core.forward_pass(fan_out_fan_in, (2.,), {})

def time_fan_out_fan_in_backward_pass():
    core.backward_pass(1., fan_end_node, fan_start_node)

def time_fan_out_fan_in_grad():
    grad(fan_out_fan_in)(2.)

## UNIT BENCHMARKS
def time_vspace_float():
    core.vspace(1.)

A = np.array([[1., 2., 3.]])

def time_vspace_array():
    core.vspace(A)

progenitors = {'dummy'}

def time_new_node_float():
    core.new_node(1., (), progenitors)

def time_new_node_array():
    core.new_node(A, (), progenitors)
<commit_msg>Updated benchmarks to new core<commit_after>import autograd.core as core
from autograd import grad
import autograd.numpy as np
import numpy as onp

## SHORT FUNCTION
def f_short(x):
    return x**2

def time_short_forward_pass():
    core.forward_pass(f_short, (2.,), {})

short_start_node, short_end_node = core.forward_pass(f_short, (2.,), {})

def time_short_backward_pass():
    core.backward_pass(1., short_end_node.node, short_start_node)

def time_short_grad():
    grad(f_short)(2.)

## LONG FUNCTION
def f_long(x):
    for i in range(50):
        x = np.sin(x)
    return x

def time_long_forward_pass():
    core.forward_pass(f_long, (2.,), {})

long_start_node, long_end_node = core.forward_pass(f_long, (2.,), {})

def time_long_backward_pass():
    core.backward_pass(1., long_end_node.node, long_start_node)

def time_long_grad():
    grad(f_long)(2.)

## 'PEARLMUTTER TEST' FUNCTION
def fan_out_fan_in(x):
    for i in range(10**4):
        x = (x + x)/2.0
    return np.sum(x)

def time_fan_out_fan_in_forward_pass():
    core.forward_pass(fan_out_fan_in, (2.,), {})

fan_start_node, fan_end_node = core.forward_pass(fan_out_fan_in, (2.,), {})

def time_fan_out_fan_in_backward_pass():
    core.backward_pass(1., fan_end_node.node, fan_start_node)

def time_fan_out_fan_in_grad():
    grad(fan_out_fan_in)(2.)

## UNIT BENCHMARKS
def time_vspace_float():
    core.vspace(1.)

A = np.array([[1., 2., 3.]])

def time_vspace_array():
    core.vspace(A)

progenitors = {'dummy'}

def time_new_box_float():
    core.new_box(1., progenitors)

def time_new_box_array():
    core.new_box(A, progenitors)

{'fraction_non_alphanumeric': 0.14325842696629212, 'fraction_numerical': 0.015605493133583021, 'mean_word_length': 4.583623693379791, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5414511', 'n_tokens_mistral': 1298, 'n_tokens_neox': 1296, 'n_words': 240}