code: def load_train_data(file_path):
      f = gzip.open(file_path, "rb")
      if sys.version_info.major > 2:
          train_set, valid_set, test_set = pickle.load(
              f, encoding="latin1"
          )
      else:
          train_set, valid_set, test_set = pickle.load(f)
      traindata = train_set[0].astype(np.float32)
      validdata = valid_set[0].astype(np.float32)
      print(traindata.shape, validdata.shape)
      return traindata, validdata
  
file_path: singa/examples/rbm/train.py
imports: from __future__ import division
  from __future__ import print_function
  from builtins import range
  import numpy
  import os
  import sys
  import gzip
  import argparse
  from singa import opt
  from singa import device
  from singa import tensor
label_desc: Use image node_id 1 for calling a global function with example usage: load_train_data(file_path) and returns: traindata,  validdata