示例#1
0
 def testAllocatingIfProgram(self):
   prog = test_programs.single_if_program()
   answer = {inst.pc_var: inst.VariableAllocation.REGISTER,
             'answer': inst.VariableAllocation.REGISTER,
             'cond': inst.VariableAllocation.REGISTER,
             'input': inst.VariableAllocation.REGISTER}
   self.assertAllocates(answer, prog)
示例#2
0
def _single_if_execute(inputs, backend):
    with tf.compat.v2.name_scope('single_if_program'):
        return vm.execute(test_programs.single_if_program(), [inputs],
                          max_stack_depth=3,
                          backend=backend)
 def interpret(n):
     return instructions.interpret(test_programs.single_if_program(), n)