Esempio n. 1
0
def _constant_execute(inputs, backend):
    # Stack depth limit is 4 to accommodate the initial value and
    # two pushes to "answer".
    with tf.compat.v2.name_scope('constant_program'):
        return vm.execute(test_programs.constant_program(), [inputs],
                          max_stack_depth=4,
                          backend=backend)
Esempio n. 2
0
 def testAllocatingConstantProgram(self):
     prog = test_programs.constant_program()
     answer = {
         inst.pc_var: inst.VariableAllocation.REGISTER,
         'answer': inst.VariableAllocation.REGISTER
     }
     self.assertAllocates(answer, prog)
 def interpret(n):
     return instructions.interpret(test_programs.constant_program(), n)