code: def add_slice(self, name, input_name, output_name, axis, start_index = 0, end_index = -1, stride = 1):
          
          spec = self.spec
          nn_spec = self.nn_spec
  
          # Add a new layer
          spec_layer = nn_spec.layers.add()
          spec_layer.name = name
          spec_layer.input.append(input_name)
          spec_layer.output.append(output_name)
          spec_layer_params = spec_layer.slice
  
          # Set the parameters
          if start_index < 0:
              raise ValueError("Invalid start_index value %d. Must be non-negative." % start_index)
          if stride < 1:
              raise ValueError("Invalid stride value %d. Must be positive." % stride)
  
          spec_layer_params.startIndex = start_index
          spec_layer_params.endIndex = end_index
          spec_layer_params.stride = stride
  
          if axis == 'channel':
              spec_layer_params.axis = \
                          _NeuralNetwork_pb2.SliceLayerParams.SliceAxis.Value('CHANNEL_AXIS')
          elif axis == 'height':
              spec_layer_params.axis = \
                          _NeuralNetwork_pb2.SliceLayerParams.SliceAxis.Value('HEIGHT_AXIS')
          elif axis == 'width':
              spec_layer_params.axis = \
                          _NeuralNetwork_pb2.SliceLayerParams.SliceAxis.Value('WIDTH_AXIS')
          else:
              raise NotImplementedError(
                  'Unsupported Slice axis %s ' % axis)
docs: Add a slice layer. Equivalent to to numpy slice [start_index:end_index:stride],
          start_index is included, while end_index is exclusive.
  
          Parameters
          ----------
          name: str
              The name of this layer.
  
          input_name: str
              The input blob name of this layer.
          output_name: str
              The output blob name of this layer.
  
          axis: str
             axis along which input is sliced.
  	       allowed values: 'channel', 'height', 'width'
          start_index: int
              must be non-negative.
          end_index: int
              negative indexing is supported.
          stride: int
              must be positive.
  
          See Also
          --------
          add_permute, add_reshape