Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def slice_to_sequence(axis, axis_key):
if isinstance(axis_key, slice) and axis in la_key_axes:
# TODO: sequence assumes the axis in the la_key is in the same order. It will be easier to solve when
# make_numpy_broadcastable automatically aligns all arrays
start, stop, step = axis_key.indices(len(axis))
return la.sequence(axis.subaxis(axis_key), initial=start, inc=step)
else:
return axis_key