MCPcopy Create free account
hub / github.com/RenderKit/oidn / tensor_gradient

Function tensor_gradient

training/image.py:34–38  ·  view source on GitHub ↗
(input)

Source from the content-addressed store, hash-verified

32
33# Computes gradient for a tensor
34def tensor_gradient(input):
35 input0 = input[..., :-1, :-1]
36 didy = input[..., 1:, :-1] - input0
37 didx = input[..., :-1, 1:] - input0
38 return torch.cat((didy, didx), -3)
39
40# Compares two image tensors using the specified error metric
41def compare_images(a, b, metric='psnr'):

Callers 1

forwardMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected