Example #1
0
def time_exp_call():
    onp.exp(2.)

def time_exp_primitive_call_unboxed():
    np.exp(2.)

def time_exp_primitive_call_boxed():
    if MASTER_BRANCH:
        np.exp(progenitor)
    else:
        np.exp(start_box)

def time_no_autograd_control():
    # Test whether the benchmarking machine is running slowly independent of autograd
    A = np.random.randn(200, 200)
    np.dot(A, A)

if MASTER_BRANCH:
    short_start_node, short_end_node = forward_pass(f_short, (2.,), {})
    long_start_node, long_end_node = forward_pass(f_long, (2.,), {})
    fan_start_node, fan_end_node = forward_pass(fan_out_fan_in, (2.,), {})
    progenitor = new_progenitor(2.)
else:
    x = 2.
    start_node = VJPNode.new_root()
    start_box = new_box(x, 0, start_node)
    _, short_end_node = trace(VJPNode.new_root(), f_short, x)
    _, long_end_node  = trace(VJPNode.new_root(), f_long, x)
    _, fan_end_node   = trace(VJPNode.new_root(), fan_out_fan_in, x)
Example #2
0
def push_new_tape():
  """Pushes a new tape onto the tape stack."""
  progenitor = ag_core.new_progenitor(ImplicitTape())
  _tape_stack.stack.append(progenitor)
  ag_core.active_progenitors.add(progenitor)
Example #3
0
File: tape.py Project: lengjia/RRL
def push_new_tape():
  """Pushes a new tape onto the tape stack."""
  progenitor = ag_core.new_progenitor(ImplicitTape())
  _tape_stack.stack.append(progenitor)
  ag_core.active_progenitors.add(progenitor)

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)


def time_exp_call():
    onp.exp(2.)


def time_exp_primitive_call_unboxed():
    np.exp(2.)


progenitor = core.new_progenitor(2.)


def time_exp_primitive_call_boxed():
    np.exp(progenitor)
Example #5
0
def time_exp_call():
    onp.exp(2.)

def time_exp_primitive_call_unboxed():
    np.exp(2.)

def time_exp_primitive_call_boxed():
    if MASTER_BRANCH:
        np.exp(progenitor)
    else:
        np.exp(start_box)

def time_no_autograd_control():
    # Test whether the benchmarking machine is running slowly independent of autograd
    A = np.random.randn(200, 200)
    np.dot(A, A)

if MASTER_BRANCH:
    short_start_node, short_end_node = forward_pass(f_short, (2.,), {})
    long_start_node, long_end_node = forward_pass(f_long, (2.,), {})
    fan_start_node, fan_end_node = forward_pass(fan_out_fan_in, (2.,), {})
    progenitor = new_progenitor(2.)
else:
    x = 2.
    start_node = VJPNode.new_root(x)
    start_box = new_box(x, 0, start_node)
    _, short_end_node = trace(VJPNode.new_root(x), f_short, x)
    _, long_end_node  = trace(VJPNode.new_root(x), f_long, x)
    _, fan_end_node   = trace(VJPNode.new_root(x), fan_out_fan_in, x)
Example #6
0
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)

def time_exp_call():
    onp.exp(2.)

def time_exp_primitive_call_unboxed():
    np.exp(2.)

progenitor = core.new_progenitor(2.)
def time_exp_primitive_call_boxed():
    np.exp(progenitor)