MCPcopy
hub / github.com/vladmandic/sdnext / grad

Method grad

modules/sharpfin/sparse_backend.py:313–325  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

311
312 @property
313 def grad(self):
314 size = self.size()
315 if not self.is_contiguous():
316 size = torch.Size((size[1], size[0]))
317 out = Matrix(size,
318 self.data.grad,
319 self.row_indices,
320 self.column_indices,
321 self.offsets,
322 self.column_indices_t,
323 self.offsets_t,
324 self.block_offsets_t)
325 return out if self.is_contiguous() else out.t()
326
327@torch.no_grad()
328def _expand_for_blocking(idxs, blocking):

Callers 2

cal_gradient_penaltyFunction · 0.80
ode_fnFunction · 0.80

Calls 4

sizeMethod · 0.95
is_contiguousMethod · 0.95
tMethod · 0.95
MatrixClass · 0.85

Tested by

no test coverage detected