Skip to content

Instantly share code, notes, and snippets.

@pureexe
Created June 12, 2018 06:11
Show Gist options
  • Select an option

  • Save pureexe/2cadba82bb98cbb9fa6d06f208749f75 to your computer and use it in GitHub Desktop.

Select an option

Save pureexe/2cadba82bb98cbb9fa6d06f208749f75 to your computer and use it in GitHub Desktop.
function [Tx,Ty] = GradU(w,b)
h = 1;
w1 = w
w2 = w
b1 = b
b2 = b
T1=w1-b1
T2=w2-b2
[m,n] = size(w);
Tx = [diff(T1);zeros(1,m)]/h;
Ty = diff(T2')';
Ty = ([Ty zeros(n,1)])/h;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment