added permute/reshape and variable scale, intercept