calculateGradWithShape :: TF.Tensor TF.Build Float -> TF.Tensor TF.Value Float -> SessionT IO ([V.Vector Float], [V.Vector Int32])
calculateGradWithShape y x = do
  gs <- TF.gradients y [x]
  xs <- TF.run gs
  (shapes :: [V.Vector Int32]) <- mapM (TF.run . TF.shape) gs
  return (xs, shapes)
calculateGradWithShape :: TF.Tensor TF.Build Float -> TF.Tensor TF.Value Float -> SessionT IO ([V.Vector Float], [V.Vector Int32])
calculateGradWithShape y x = do
  gs <- TF.gradients y [x]
  xs <- TF.run gs
  (shapes :: [V.Vector Int32]) <- mapM (TF.run . TF.shape) gs
  return (xs, shapes)
calculateGradWithShape y x = do
  gs <- TF.gradients y [x]
  xs <- TF.run gs
  (shapes :: [V.Vector Int32]) <- mapM (TF.run . TF.shape) gs
  return (xs, shapes)