def slice(x, start, size):
if not (len(int_shape(x)) == len(start) == len(size)):
raise ValueError("The dimension and the size of indices should match.")
out = x[tuple([py_slice(i, i + j) for (i, j) in zip(start, size)])]
out._keras_shape = tuple(size)
return out
def pattern_broadcast(x, broadcastable):
return T.patternbroadcast(x, broadcastable)