parameters: (cls, ctx, dneg_logprobs)
return_statement: return neg_logprobs, None
docstring: We know d(-log(p[i])/dlogit[k] = -id_mat[i,k] + p[k]
          so we initialize the gradient as neg_logprobs, so we can just exponentiate
          to get p[k], which is most of what we need...  neg_logprobs will be
          modified in place to become the gradient we want
docstring_summary: We know d(-log(p[i])/dlogit[k] = -id_mat[i,k] + p[k]
          so we initialize the gradient as neg_logprobs, so we can just exponentiate
          to get p[k], which is most of what we need...  neg_logprobs will be
          modified in place to become the gradient we want
docstring_tokens: We know d ( - log ( p [ i ] ) / dlogit [ k ] = - id_mat [ i k ] + p [ k ] so we initialize the gradient as neg_logprobs so we can just exponentiate to get p [ k ] which is most of what we need ... neg_logprobs will be modified in place to become the gradient we want
function: def backward(cls, ctx, dneg_logprobs):
          """We know d(-log(p[i])/dlogit[k] = -id_mat[i,k] + p[k]
          so we initialize the gradient as neg_logprobs, so we can just exponentiate
          to get p[k], which is most of what we need...  neg_logprobs will be
          modified in place to become the gradient we want
          """
          # load saved tensors
          neg_logprobs, indices = ctx.saved_tensors
          # run the kernel
          # neg_logprobs will be modified in place to become our gradient:
          n_cols = neg_logprobs.shape[-1]
          grid = lambda opt: (neg_logprobs.numel() // n_cols, )
          _backward[grid](neg_logprobs, indices, dneg_logprobs, n_cols)
          return neg_logprobs, None
function_tokens: def backward ( cls , ctx , dneg_logprobs ) : # load saved tensors neg_logprobs , indices = ctx . saved_tensors # run the kernel # neg_logprobs will be modified in place to become our gradient: n_cols = neg_logprobs . shape [ - 1 ] grid = lambda opt : ( neg_logprobs . numel ( ) // n_cols , ) _backward [ grid ] ( neg_logprobs , indices , dneg_logprobs , n_cols ) return neg_logprobs , None