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)
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)