detach method

Tensor detach()

Implementation

Tensor detach() {
  // Pull data from GPU
  final values = fetchData();

  // Create a brand-new tensor with identical data
  // This tensor has NO autograd history
  final detached = Tensor.fromList(shape, values);

  return detached;
}