Use cast::GetCastDataType to handle "from_type" and "to" arguments
Use cast::GetCastDataType to handle "from_type" and "to" arguments

Summary: Also enforce the "from_type" argument is supplied when getting gradient

Reviewed By: Yangqing

Differential Revision: D5684399

fbshipit-source-id: bee955d44a04c44142b2212cff548cea6e08b22f

xzturn/caffe2,Yangqing/caffe2,pietern/caffe2,Yangqing/caffe2,davinwang/caffe2,caffe2/caffe2,Yangqing/caffe2,pietern/caffe2,pietern/caffe2,xzturn/caffe2,sf-wind/caffe2,xzturn/caffe2,sf-wind/caffe2,davinwang/caffe2,xzturn/caffe2,pietern/caffe2,Yangqing/caffe2,pietern/caffe2,davinwang/caffe2,davinwang/caffe2,sf-wind/caffe2,davinwang/caffe2,xzturn/caffe2,sf-wind/caffe2,Yangqing/caffe2,sf-wind/caffe2