Taken care of code review comments partially
Taken care of all comments
Tensor Type has now a sparse grad attribute which can be set or unset to determine if sparse gradient is to be enabled or not. Note if needed, we can provide getters and setters to set the attributes to provide more clean interfaces to application. Right now application can access this attribute and set it before calculating gradient