title: How to pass a data structure like dictionary to call() of LSTM layer?
body: <p>Suppose, I have a following dictionary constructed as below:</p>
  <pre><code>
  od = OrderedDict()
  od['a'] = 1
  od['b'] = 2
  od['c'] = 3
  od['d'] = 4
  </code></pre>
  <p>and let's say I need to pass this to the LSTM call() function. So, the code for model definition along with other code is as below:</p>
  <pre><code>import numpy
  import matplotlib.pyplot as plt
  from pandas import read_csv
  import math
  from tensorflow.keras.models import *
  from tensorflow.keras.layers import Dense, Input
  #from tensorflow.keras.layers import LSTM
  from sklearn.preprocessing import MinMaxScaler
  from sklearn.metrics import mean_squared_error
  
  
  # convert an array of values into a dataset matrix
  def create_dataset(dataset, look_back=1):
      dataX, dataY = [], []
      for i in range(len(dataset)-look_back-1):
          a = dataset[i:(i+look_back), 0]
          dataX.append(a)
          dataY.append(dataset[i + look_back, 0])
      return numpy.array(dataX), numpy.array(dataY)
  
  # fix random seed for reproducibility
  numpy.random.seed(7)
  
  # load the dataset
  dataframe = read_csv('https://raw.githubusercontent.com/jbrownlee/Datasets/master/airline-passengers.csv', usecols=[1], engine='python')
  dataset = dataframe.values
  dataset = dataset.astype('float32')
  
  # normalize the dataset
  scaler = MinMaxScaler(feature_range=(0, 1))
  dataset = scaler.fit_transform(dataset)
  
  # split into train and test sets
  train_size = int(len(dataset) * 0.67)
  test_size = len(dataset) - train_size
  train, test = dataset[0:train_size,:], dataset[train_size:len(dataset),:]
  
  # reshape into X=t and Y=t+1
  look_back = 1
  trainX, trainY = create_dataset(train, look_back)
  testX, testY = create_dataset(test, look_back)
  
  # reshape input to be [samples, time steps, features]
  trainX = numpy.reshape(trainX, (trainX.shape[0], 1, trainX.shape[1]))
  testX = numpy.reshape(testX, (testX.shape[0], 1, testX.shape[1]))
  
  # create and fit the LSTM network
  # model = Sequential()
  # model.add(LSTM(4, input_shape=(1, look_back)))
  # model.add(Dense(1))
  
  inp = Input(shape = (1, look_back), name = &quot;Input&quot;)
  #od_tensor = K.variable([od])
  #inp2 = Input(tensor = od_tensor)
  x = LSTM(4)([inp, od])
  out = Dense(1)(x)
  
  model = Model(inp, out)
  
  model.compile(loss='mean_squared_error', optimizer='adam')
  model.summary()
  
  model.fit(trainX, trainY, epochs=100, batch_size=1, verbose=2)
  </code></pre>
  <p>Within the call() function of LSTM layer, I want to check, if the function is getting the inputs, so the code will be like below:</p>
  <pre><code>  def call(self, inputs, mask=None, training=None, initial_state=None):
      print(&quot;inputs[0]: &quot;, inputs[0])
      print(&quot;inputs[1]: &quot;, inputs[1])
      inputs_0 = inputs[0]
      self._maybe_reset_cell_dropout_mask(self.cell)
      return super(LSTM, self).call(
          inputs_0, mask=mask, training=training, initial_state=initial_state)
  </code></pre>
  <p>The data structure will not change at any point during training, but will be used for some other processing purpose. Is there a way to get this working by passing the dictionary to the call function? How can this data structure be converted to tensor format?</p>