Wipe out dropout operations from TensorFlow graph

后端 未结 2 786
天命终不由人
天命终不由人 2021-01-01 07:05

I have a trained freezed graph that I am trying to run on an ARM device. Basically, I am using contrib/pi_examples/label_image, but with my network instead of Inception. My

2条回答
  •  猫巷女王i
    2021-01-01 07:49

    How about this as a more general solution:

    for node in temp_graph_def.node:
        for idx, i in enumerate(node.input):
            input_clean = node_name_from_input(i)
            if input_clean.endswith('/cond/Merge') and input_clean.split('/')[-3].startswith('dropout'):
                identity = node_from_map(input_node_map, i).input[0]
                assert identity.split('/')[-1] == 'Identity'
                parent = node_from_map(input_node_map, node_from_map(input_node_map, identity).input[0])
                pred_id = parent.input[1]
                assert pred_id.split('/')[-1] == 'pred_id'            
                good = parent.input[0]
                node.input[idx] = good
    

提交回复
热议问题