I have defined a theano function which given a matrix(named array) and a
list of integers (named split_cts), splits the array into rows such that
number of rows in i th split = split_cts[i] and returns the sum of each
split joined together as a tensor. However when I try to differentiate it,
it gives me a gradient error. Specifically, the error says:
NotImplementedError: Grad is not implemented for inputs withnumber of
dimension other than 1.
The function is as follows:
def split_sum(array, split_cts):
'''
Given an array like and an array of counts, it returns an array where
each element is the sum of count number of indices in array
That is retval[i] = sum(array[counts.cumsum()[i-1]:counts.cumsum()[i]])
'''
sep = cumsum(split_cts) - 1
return diff(T.concatenate((T.zeros((array.shape[1], ))[None,:], cumsum(
array, axis=0)[sep]), axis=0), axis=0)
How do I make it differentiable? Any help would be appreciated.
--
---
You received this message because you are subscribed to the Google Groups
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.