By wrapping tensors (which already require gradients) in a new tensor, you are detaching the new tensor from the computation graph.
E.g. my_func should return a valid tensor, which shouldn’t be wrapped again.
Also, Variables are deprecated, so you can just use tensors and set their requires_grad attribute to True.