#!/usr/bin/env pythonfrom__future__importprint_functionimportdifflibimportsyswithopen(sys.argv[1],'r')asf:origin=f.read()origin=origin.splitlines()withopen(sys.argv[2],'r')asf:new=f.read()new=new.splitlines()differ=difflib.Differ()result=differ.compare(origin,new)error=Falseprint('API Difference is: ')foreach_diffinresult:ifeach_diff[0]in['-','?']:# delete or change API is not allowederror=Trueelifeach_diff[0]=='+':# only new layers is allowed.ifnoteach_diff.startswith('+ paddle.fluid.layers.'):error=Trueifeach_diff[0]!=' ':print(each_diff)iferror:sys.exit(1)