Ejemplo n.º 1
0
 def infer_shape(self, node, inputs_shapes):
     if isinstance(node.inputs[1], theano.Constant) and node.inputs[1].data is None:
         return [(mul(*inputs_shapes[0]),)]
     # axis should not be None, so there should be the same number of
     # dimensions in the input and output
     assert node.inputs[0].ndim == node.outputs[0].ndim
     assert inputs_shapes[1] == ()
     return [inputs_shapes[0]]
Ejemplo n.º 2
0
 def infer_shape(self, node, inputs_shapes):
     if (isinstance(node.inputs[1], theano.Constant)
             and node.inputs[1].data is None):
         return [(mul(*inputs_shapes[0]), )]
     # axis should not be None, so there should be the same number of
     # dimensions in the input and output
     assert node.inputs[0].ndim == node.outputs[0].ndim
     assert inputs_shapes[1] == ()
     return [inputs_shapes[0]]
Ejemplo n.º 3
0
 def infer_shape(self, node, inputs_shapes):
     if isinstance(node.inputs[1], theano.Constant) and node.inputs[1].data is None:
         # That means axis = None,
         # So the array is flattened before being sorted
         return [(mul(*inputs_shapes[0]),)]
     # axis should not be None
     # So there should be the same number of dimensions
     # in the input and output
     assert node.inputs[0].ndim == node.outputs[0].ndim
     assert inputs_shapes[1] == ()
     return [inputs_shapes[0]]
Ejemplo n.º 4
0
 def infer_shape(self, node, inputs_shapes):
     if (isinstance(node.inputs[1], theano.Constant)
             and node.inputs[1].data is None):
         # That means axis = None,
         # So the array is flattened before being sorted
         return [(mul(*inputs_shapes[0]), )]
     # axis should not be None
     # So there should be the same number of dimensions
     # in the input and output
     assert node.inputs[0].ndim == node.outputs[0].ndim
     assert inputs_shapes[1] == ()
     return [inputs_shapes[0]]
Ejemplo n.º 5
0
def simple():
    '''Contains functionalities for simple calculator.'''
    rep1 = 1
    while (rep1 == 1):
        print " Simple Calculator ".center(80, '-')
        print " " * 10, "Menu :"
        print " " * 15, "1. Addition"
        print " " * 15, "2. Subtraction"
        print " " * 15, "3. Multiplication"
        print " " * 15, "4. Division"
        print " " * 15, "5. Back to main menu"
        opt = input("Select operation : ")

        os.system("clear")

        if (opt == 1):
            num1, num2 = input_fun()
            print "Result of addition :\n", "%r + %r = %r" % (
                num1, num2, basic.add(num1, num2))
            rep1 = 1
        elif (opt == 2):
            num1, num2 = input_fun()
            print "Result of subtraction :\n", "%r - %r = %r" % (
                num1, num2, basic.sub(num1, num2))
            rep1 = 1
        elif (opt == 3):
            num1, num2 = input_fun()
            print "Result of multiplication :\n", "%r * %r = %r" % (
                num1, num2, basic.mul(num1, num2))
            rep1 = 1
        elif (opt == 4):
            num1, num2 = input_fun()
            print "Result of division :\n", "%r / %r = %r" % (
                num1, num2, basic.div(num1, num2))
            rep1 = 1
        elif (opt == 5):
            print "Leaving simple calculator..."
            print "Entering main menu..."
            return 1
        else:
            print "*" * 80
            print "  INVALID INPUT  ".center(80, '!')
            print "*" * 80