code: def test_slice_layer():
      from lasagne.layers import (
          SliceLayer,
          InputLayer,
          get_output_shape,
          get_output,
      )
      from numpy.testing import assert_array_almost_equal as aeq
  
      in_shp = (3, 5, 2)
      l_inp = InputLayer(in_shp)
      l_slice_ax0 = SliceLayer(l_inp, axis=0, indices=0)
      l_slice_ax1 = SliceLayer(l_inp, axis=1, indices=slice(3, 5))
      l_slice_ax2 = SliceLayer(l_inp, axis=-1, indices=-1)
  
      x = np.arange(np.prod(in_shp)).reshape(in_shp).astype("float32")
      x1 = x[0]
      x2 = x[:, 3:5]
      x3 = x[:, :, -1]
  
      assert get_output_shape(l_slice_ax0) == x1.shape
      assert get_output_shape(l_slice_ax1) == x2.shape
      assert get_output_shape(l_slice_ax2) == x3.shape
  
      aeq(get_output(l_slice_ax0, x).eval(), x1)
      aeq(get_output(l_slice_ax1, x).eval(), x2)
      aeq(get_output(l_slice_ax2, x).eval(), x3)
  
      # test slicing None dimension
      in_shp = (2, None, 2)
      l_inp = InputLayer(in_shp)
      l_slice_ax1 = SliceLayer(l_inp, axis=1, indices=slice(3, 5))
      assert get_output_shape(l_slice_ax1) == (2, None, 2)
      aeq(get_output(l_slice_ax1, x).eval(), x2)
  
imports: import numpy
  import pytest
  import theano
  from mock import Mock
label_desc: Use image node_id 1 for calling a global function with example usage: test_slice_layer() without return types