MCPcopy Create free account
hub / github.com/PythonOT/POT / detach

Method detach

ot/backend.py:290–297  ·  view source on GitHub ↗

Detach the tensors from the computation graph See: https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html

(self, *arrays)

Source from the content-addressed store, hash-verified

288 raise NotImplementedError()
289
290 def detach(self, *arrays):
291 """Detach the tensors from the computation graph
292
293 See: https://pytorch.org/docs/stable/generated/torch.Tensor.detach.html"""
294 if len(arrays) == 1:
295 return self._detach(arrays[0])
296 else:
297 return [self._detach(array) for array in arrays]
298
299 def _detach(self, a):
300 """Detach the tensor from the computation graph"""

Callers 15

test_empty_backendFunction · 0.95
solveFunction · 0.80
_to_numpyMethod · 0.80
_detachMethod · 0.80
ground_baryFunction · 0.80
binary_search_circleFunction · 0.80
solve_batchFunction · 0.80
solve_gromov_batchFunction · 0.80
detach_cost_tensorFunction · 0.80
bregman_projection_batchFunction · 0.80

Calls 1

_detachMethod · 0.95

Tested by 3

test_empty_backendFunction · 0.76
test_func_backendsFunction · 0.64
test_emd2_gradientsFunction · 0.64