Created by: liu-plus-wei
cherry pick #23856 :
Type check consumes too much time in dygraph mode: about 8~10 times to other framework. Change the code to call API directly in dygraph mode.