Beispiel #1
0
def Q8(A, b):
    A_node = nn.Input("A")
    x = nn.Input("x")
    b_node = nn.Input("b")
    expression = A_node * x + b_node
    cc = expression.compile(golden.Builder())
    return cc(A=A, b=b)
Beispiel #2
0
def grade_Q10():
    x = nn.Input("x")
    y = nn.Input("y")
    c1 = nn.Const(np.random.random((11, 12)))
    c2 = nn.Const(np.random.random((12, 13)))
    z = x * y - x * c2 - c1 * y + c1 * c2
    return is_same(z, 1, x=(11, 12), y=(12, 13))
Beispiel #3
0
def grade_Q4():
    x = nn.Input("x")
    y = nn.Input("y")
    z = x - y
    return all([
        is_same(z, 1, x=(11, ), y=(11, )),
        is_same(z, 1, x=(11, 12), y=(11, 12)),
        is_same(z, 1, x=(11, 12, 13), y=(11, 12, 13)),
        is_same(z, 1, x=(11, 12, 13, 14), y=(11, 12, 13, 14))
    ])
Beispiel #4
0
def Q10():
    relu = nn.ReLU()
    x = nn.Input('x')
    y = relu(x)
    d = relu(-x)
    a = y + d
    return a
Beispiel #5
0
def Q9(n):
    x = nn.Input("x")
    expression = x
    if (n > 1):
        for i in range(n - 1):
            expression = x * expression
    return expression
def Q9(n):
    a = n
    x = nn.Input('x')
    n = nn.Const(n)
    ans = nn.Const(1)
    for i in range(a):
        ans = ans * x
    return ans
def grade_Q4():
    f = nn.Linear("f", 100, 10)
    x = f(nn.Input("x"))
    x.resolve({
        "f.weight": np.random.random((10, 100)),
        "f.bias": np.random.random((10, ))
    })
    return is_same(x, 1, x=(50, 100))
def Q8(
    A, b
):  ### how does it know x looked at syntax in grade file and does not make sense what does (x=x) at end of statement do?
    A = nn.Const(A)
    b = nn.Const(b)
    x = nn.Input('x')
    ans = A * x + b
    return ans
Beispiel #9
0
def Q10():
    x = nn.Input("x")
    return (x * x) / x
def grade_Q7():
    x = nn.Input("x")
    y = nn.Input("y")
    z = nn.Input("z")
    r = x + y * z
    return is_same(r, 1, x=None, y=None, z=None)
def grade_Q10():
    x = nn.Input("x")
    y = nn.Input("y")
    c = nn.Const(np.random.random())
    z = x * y - x * c - y * c + c * c
    return is_same(z, 10, x=None, y=None)
Beispiel #12
0
def grade_Q6():
    x = nn.Input("x")
    y = nn.Input("y")
    z = x * y
    return is_same(z, 1, x=None, y=(12, 13)) and is_same(
        z, 1, x=(11, 12), y=None)
def grade_Q6():
    x = nn.Input("x")
    y = nn.Input("y")
    z = x * y
    return is_same(z, 1, x=None, y=None)
Beispiel #14
0
def Q8(A, b):
    A = nn.Const(A)
    x = nn.Input("x")
    b = nn.Const(b)
    c = A*x+b
    return c
def Q10():
    x = nn.Input('x')

    return nn.ReLU()(x) + nn.ReLU()(-x)
def Q7():
    a = nn.Input("a")
    b = nn.Input("b")
    c = nn.Input("c")
    d = a + b * c
    return d
def Q6():
    a = nn.Input("a")
    b = nn.Input("b")
    c = a + b
    return c
def grade_Q1():
    relu = nn.ReLU()
    x = relu(nn.Input("x"))
    return is_same(x, 1, x=(10, 11, 12, 13))
Beispiel #19
0
def Q9(n):
    x = nn.Input("x")
    c = pow(x, n)
    return c
def grade_Q2():
    flatten = nn.Flatten()
    x = flatten(nn.Input("x"))
    return is_same(x, 1, x=(10, 11, 12, 13))
Beispiel #21
0
def grade_Q9():
    x = nn.Input("x")
    y = nn.Input("y")
    z = nn.Input("z")
    r = x * y * z
    return is_same(r, 1, x=(11, 12), y=(12, 13), z=(13, 14))
Beispiel #22
0
def grade_Q1():
    x = nn.Input("x")
    return is_same(x, 1, x=(9, )) and is_same(x, 1, x=(9, 9))
def grade_Q4():
    x = nn.Input("x")
    c = nn.Const(np.random.random())
    y = x * c
    return is_same(y, 1, x=None)
Beispiel #24
0
def grade_Q5():
    x = nn.Input("x")
    y = nn.Input("y")
    z = x * y
    return is_same(z, 1, x=(11, 12), y=(12, 13))
Beispiel #25
0
def Q7():
    a = nn.Input("a")
    b = nn.Input("b")
    c = nn.Input("c")
    return a + b * c
Beispiel #26
0
def grade_Q8():
    x = nn.Input("x")
    y = nn.Input("y")
    z = nn.Input("z")
    r = (x - y) * z
    return is_same(r, 1, x=(11, 12), y=(11, 12), z=(12, 13))
def grade_Q8():
    x = nn.Input("x")
    y = nn.Input("y")
    z = nn.Input("z")
    r = (x - y) * z
    return is_same(r, 1, x=None, y=None, z=None)
Beispiel #28
0
def Q6():
    a = nn.Input("a")
    b = nn.Input("b")
    return a + b
def grade_Q1():
    x = nn.Input("x")
    return is_same(x, 1, x=None)