<reponame>tOba1357/kabu<gh_stars>0
#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from thrift.Thrift import TType, TMessageType, TException, TApplicationException
import logging
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class Iface:
  def learn(self, inputData, targets, epochSize, batchSize):
    """
    Parameters:
     - inputData
     - targets
     - epochSize
     - batchSize
    """
    pass

  def precit(self, inputData):
    """
    Parameters:
     - inputData
    """
    pass


class Client(Iface):
  def __init__(self, iprot, oprot=None):
    self._iprot = self._oprot = iprot
    if oprot is not None:
      self._oprot = oprot
    self._seqid = 0

  def learn(self, inputData, targets, epochSize, batchSize):
    """
    Parameters:
     - inputData
     - targets
     - epochSize
     - batchSize
    """
    self.send_learn(inputData, targets, epochSize, batchSize)
    self.recv_learn()

  def send_learn(self, inputData, targets, epochSize, batchSize):
    self._oprot.writeMessageBegin('learn', TMessageType.CALL, self._seqid)
    args = learn_args()
    args.inputData = inputData
    args.targets = targets
    args.epochSize = epochSize
    args.batchSize = batchSize
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_learn(self):
    iprot = self._iprot
    (fname, mtype, rseqid) = iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(iprot)
      iprot.readMessageEnd()
      raise x
    result = learn_result()
    result.read(iprot)
    iprot.readMessageEnd()
    return

  def precit(self, inputData):
    """
    Parameters:
     - inputData
    """
    self.send_precit(inputData)
    return self.recv_precit()

  def send_precit(self, inputData):
    self._oprot.writeMessageBegin('precit', TMessageType.CALL, self._seqid)
    args = precit_args()
    args.inputData = inputData
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_precit(self):
    iprot = self._iprot
    (fname, mtype, rseqid) = iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(iprot)
      iprot.readMessageEnd()
      raise x
    result = precit_result()
    result.read(iprot)
    iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "precit failed: unknown result")


class Processor(Iface, TProcessor):
  def __init__(self, handler):
    self._handler = handler
    self._processMap = {}
    self._processMap["learn"] = Processor.process_learn
    self._processMap["precit"] = Processor.process_precit

  def process(self, iprot, oprot):
    (name, type, seqid) = iprot.readMessageBegin()
    if name not in self._processMap:
      iprot.skip(TType.STRUCT)
      iprot.readMessageEnd()
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
      x.write(oprot)
      oprot.writeMessageEnd()
      oprot.trans.flush()
      return
    else:
      self._processMap[name](self, seqid, iprot, oprot)
    return True

  def process_learn(self, seqid, iprot, oprot):
    args = learn_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = learn_result()
    try:
      self._handler.learn(args.inputData, args.targets, args.epochSize, args.batchSize)
      msg_type = TMessageType.REPLY
    except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
      raise
    except Exception as ex:
      msg_type = TMessageType.EXCEPTION
      logging.exception(ex)
      result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
    oprot.writeMessageBegin("learn", msg_type, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_precit(self, seqid, iprot, oprot):
    args = precit_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = precit_result()
    try:
      result.success = self._handler.precit(args.inputData)
      msg_type = TMessageType.REPLY
    except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
      raise
    except Exception as ex:
      msg_type = TMessageType.EXCEPTION
      logging.exception(ex)
      result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
    oprot.writeMessageBegin("precit", msg_type, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()


# HELPER FUNCTIONS AND STRUCTURES

class learn_args:
  """
  Attributes:
   - inputData
   - targets
   - epochSize
   - batchSize
  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'inputData', (TType.LIST,(TType.LIST,(TType.DOUBLE,None))), None, ), # 1
    (2, TType.LIST, 'targets', (TType.LIST,(TType.DOUBLE,None)), None, ), # 2
    (3, TType.I16, 'epochSize', None, None, ), # 3
    (4, TType.I16, 'batchSize', None, None, ), # 4
  )

  def __init__(self, inputData=None, targets=None, epochSize=None, batchSize=None,):
    self.inputData = inputData
    self.targets = targets
    self.epochSize = epochSize
    self.batchSize = batchSize

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.LIST:
          self.inputData = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = []
            (_etype9, _size6) = iprot.readListBegin()
            for _i10 in xrange(_size6):
              _elem11 = []
              (_etype15, _size12) = iprot.readListBegin()
              for _i16 in xrange(_size12):
                _elem17 = iprot.readDouble()
                _elem11.append(_elem17)
              iprot.readListEnd()
              _elem5.append(_elem11)
            iprot.readListEnd()
            self.inputData.append(_elem5)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.LIST:
          self.targets = []
          (_etype21, _size18) = iprot.readListBegin()
          for _i22 in xrange(_size18):
            _elem23 = []
            (_etype27, _size24) = iprot.readListBegin()
            for _i28 in xrange(_size24):
              _elem29 = iprot.readDouble()
              _elem23.append(_elem29)
            iprot.readListEnd()
            self.targets.append(_elem23)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I16:
          self.epochSize = iprot.readI16()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I16:
          self.batchSize = iprot.readI16()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('learn_args')
    if self.inputData is not None:
      oprot.writeFieldBegin('inputData', TType.LIST, 1)
      oprot.writeListBegin(TType.LIST, len(self.inputData))
      for iter30 in self.inputData:
        oprot.writeListBegin(TType.LIST, len(iter30))
        for iter31 in iter30:
          oprot.writeListBegin(TType.DOUBLE, len(iter31))
          for iter32 in iter31:
            oprot.writeDouble(iter32)
          oprot.writeListEnd()
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.targets is not None:
      oprot.writeFieldBegin('targets', TType.LIST, 2)
      oprot.writeListBegin(TType.LIST, len(self.targets))
      for iter33 in self.targets:
        oprot.writeListBegin(TType.DOUBLE, len(iter33))
        for iter34 in iter33:
          oprot.writeDouble(iter34)
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.epochSize is not None:
      oprot.writeFieldBegin('epochSize', TType.I16, 3)
      oprot.writeI16(self.epochSize)
      oprot.writeFieldEnd()
    if self.batchSize is not None:
      oprot.writeFieldBegin('batchSize', TType.I16, 4)
      oprot.writeI16(self.batchSize)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.inputData)
    value = (value * 31) ^ hash(self.targets)
    value = (value * 31) ^ hash(self.epochSize)
    value = (value * 31) ^ hash(self.batchSize)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class learn_result:

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('learn_result')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class precit_args:
  """
  Attributes:
   - inputData
  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'inputData', (TType.LIST,(TType.LIST,(TType.DOUBLE,None))), None, ), # 1
  )

  def __init__(self, inputData=None,):
    self.inputData = inputData

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.LIST:
          self.inputData = []
          (_etype38, _size35) = iprot.readListBegin()
          for _i39 in xrange(_size35):
            _elem40 = []
            (_etype44, _size41) = iprot.readListBegin()
            for _i45 in xrange(_size41):
              _elem46 = []
              (_etype50, _size47) = iprot.readListBegin()
              for _i51 in xrange(_size47):
                _elem52 = iprot.readDouble()
                _elem46.append(_elem52)
              iprot.readListEnd()
              _elem40.append(_elem46)
            iprot.readListEnd()
            self.inputData.append(_elem40)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('precit_args')
    if self.inputData is not None:
      oprot.writeFieldBegin('inputData', TType.LIST, 1)
      oprot.writeListBegin(TType.LIST, len(self.inputData))
      for iter53 in self.inputData:
        oprot.writeListBegin(TType.LIST, len(iter53))
        for iter54 in iter53:
          oprot.writeListBegin(TType.DOUBLE, len(iter54))
          for iter55 in iter54:
            oprot.writeDouble(iter55)
          oprot.writeListEnd()
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.inputData)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class precit_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.LIST,(TType.DOUBLE,None)), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype59, _size56) = iprot.readListBegin()
          for _i60 in xrange(_size56):
            _elem61 = []
            (_etype65, _size62) = iprot.readListBegin()
            for _i66 in xrange(_size62):
              _elem67 = iprot.readDouble()
              _elem61.append(_elem67)
            iprot.readListEnd()
            self.success.append(_elem61)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('precit_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.LIST, len(self.success))
      for iter68 in self.success:
        oprot.writeListBegin(TType.DOUBLE, len(iter68))
        for iter69 in iter68:
          oprot.writeDouble(iter69)
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.success)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

#
# Autogenerated by Thrift Compiler (0.9.3)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from thrift.Thrift import TType, TMessageType, TException, TApplicationException
import logging
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class Iface:
  def learn(self, inputData, targets, epochSize, batchSize):
    """
    Parameters:
     - inputData
     - targets
     - epochSize
     - batchSize
    """
    pass

  def precit(self, inputData):
    """
    Parameters:
     - inputData
    """
    pass


class Client(Iface):
  def __init__(self, iprot, oprot=None):
    self._iprot = self._oprot = iprot
    if oprot is not None:
      self._oprot = oprot
    self._seqid = 0

  def learn(self, inputData, targets, epochSize, batchSize):
    """
    Parameters:
     - inputData
     - targets
     - epochSize
     - batchSize
    """
    self.send_learn(inputData, targets, epochSize, batchSize)
    self.recv_learn()

  def send_learn(self, inputData, targets, epochSize, batchSize):
    self._oprot.writeMessageBegin('learn', TMessageType.CALL, self._seqid)
    args = learn_args()
    args.inputData = inputData
    args.targets = targets
    args.epochSize = epochSize
    args.batchSize = batchSize
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_learn(self):
    iprot = self._iprot
    (fname, mtype, rseqid) = iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(iprot)
      iprot.readMessageEnd()
      raise x
    result = learn_result()
    result.read(iprot)
    iprot.readMessageEnd()
    return

  def precit(self, inputData):
    """
    Parameters:
     - inputData
    """
    self.send_precit(inputData)
    return self.recv_precit()

  def send_precit(self, inputData):
    self._oprot.writeMessageBegin('precit', TMessageType.CALL, self._seqid)
    args = precit_args()
    args.inputData = inputData
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_precit(self):
    iprot = self._iprot
    (fname, mtype, rseqid) = iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(iprot)
      iprot.readMessageEnd()
      raise x
    result = precit_result()
    result.read(iprot)
    iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    raise TApplicationException(TApplicationException.MISSING_RESULT, "precit failed: unknown result")


class Processor(Iface, TProcessor):
  def __init__(self, handler):
    self._handler = handler
    self._processMap = {}
    self._processMap["learn"] = Processor.process_learn
    self._processMap["precit"] = Processor.process_precit

  def process(self, iprot, oprot):
    (name, type, seqid) = iprot.readMessageBegin()
    if name not in self._processMap:
      iprot.skip(TType.STRUCT)
      iprot.readMessageEnd()
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
      x.write(oprot)
      oprot.writeMessageEnd()
      oprot.trans.flush()
      return
    else:
      self._processMap[name](self, seqid, iprot, oprot)
    return True

  def process_learn(self, seqid, iprot, oprot):
    args = learn_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = learn_result()
    try:
      self._handler.learn(args.inputData, args.targets, args.epochSize, args.batchSize)
      msg_type = TMessageType.REPLY
    except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
      raise
    except Exception as ex:
      msg_type = TMessageType.EXCEPTION
      logging.exception(ex)
      result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
    oprot.writeMessageBegin("learn", msg_type, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()

  def process_precit(self, seqid, iprot, oprot):
    args = precit_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = precit_result()
    try:
      result.success = self._handler.precit(args.inputData)
      msg_type = TMessageType.REPLY
    except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
      raise
    except Exception as ex:
      msg_type = TMessageType.EXCEPTION
      logging.exception(ex)
      result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
    oprot.writeMessageBegin("precit", msg_type, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()


# HELPER FUNCTIONS AND STRUCTURES

class learn_args:
  """
  Attributes:
   - inputData
   - targets
   - epochSize
   - batchSize
  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'inputData', (TType.LIST,(TType.LIST,(TType.DOUBLE,None))), None, ), # 1
    (2, TType.LIST, 'targets', (TType.LIST,(TType.DOUBLE,None)), None, ), # 2
    (3, TType.I16, 'epochSize', None, None, ), # 3
    (4, TType.I16, 'batchSize', None, None, ), # 4
  )

  def __init__(self, inputData=None, targets=None, epochSize=None, batchSize=None,):
    self.inputData = inputData
    self.targets = targets
    self.epochSize = epochSize
    self.batchSize = batchSize

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.LIST:
          self.inputData = []
          (_etype3, _size0) = iprot.readListBegin()
          for _i4 in xrange(_size0):
            _elem5 = []
            (_etype9, _size6) = iprot.readListBegin()
            for _i10 in xrange(_size6):
              _elem11 = []
              (_etype15, _size12) = iprot.readListBegin()
              for _i16 in xrange(_size12):
                _elem17 = iprot.readDouble()
                _elem11.append(_elem17)
              iprot.readListEnd()
              _elem5.append(_elem11)
            iprot.readListEnd()
            self.inputData.append(_elem5)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 2:
        if ftype == TType.LIST:
          self.targets = []
          (_etype21, _size18) = iprot.readListBegin()
          for _i22 in xrange(_size18):
            _elem23 = []
            (_etype27, _size24) = iprot.readListBegin()
            for _i28 in xrange(_size24):
              _elem29 = iprot.readDouble()
              _elem23.append(_elem29)
            iprot.readListEnd()
            self.targets.append(_elem23)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      elif fid == 3:
        if ftype == TType.I16:
          self.epochSize = iprot.readI16()
        else:
          iprot.skip(ftype)
      elif fid == 4:
        if ftype == TType.I16:
          self.batchSize = iprot.readI16()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('learn_args')
    if self.inputData is not None:
      oprot.writeFieldBegin('inputData', TType.LIST, 1)
      oprot.writeListBegin(TType.LIST, len(self.inputData))
      for iter30 in self.inputData:
        oprot.writeListBegin(TType.LIST, len(iter30))
        for iter31 in iter30:
          oprot.writeListBegin(TType.DOUBLE, len(iter31))
          for iter32 in iter31:
            oprot.writeDouble(iter32)
          oprot.writeListEnd()
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.targets is not None:
      oprot.writeFieldBegin('targets', TType.LIST, 2)
      oprot.writeListBegin(TType.LIST, len(self.targets))
      for iter33 in self.targets:
        oprot.writeListBegin(TType.DOUBLE, len(iter33))
        for iter34 in iter33:
          oprot.writeDouble(iter34)
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    if self.epochSize is not None:
      oprot.writeFieldBegin('epochSize', TType.I16, 3)
      oprot.writeI16(self.epochSize)
      oprot.writeFieldEnd()
    if self.batchSize is not None:
      oprot.writeFieldBegin('batchSize', TType.I16, 4)
      oprot.writeI16(self.batchSize)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.inputData)
    value = (value * 31) ^ hash(self.targets)
    value = (value * 31) ^ hash(self.epochSize)
    value = (value * 31) ^ hash(self.batchSize)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class learn_result:

  thrift_spec = (
  )

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('learn_result')
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class precit_args:
  """
  Attributes:
   - inputData
  """

  thrift_spec = (
    None, # 0
    (1, TType.LIST, 'inputData', (TType.LIST,(TType.LIST,(TType.DOUBLE,None))), None, ), # 1
  )

  def __init__(self, inputData=None,):
    self.inputData = inputData

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.LIST:
          self.inputData = []
          (_etype38, _size35) = iprot.readListBegin()
          for _i39 in xrange(_size35):
            _elem40 = []
            (_etype44, _size41) = iprot.readListBegin()
            for _i45 in xrange(_size41):
              _elem46 = []
              (_etype50, _size47) = iprot.readListBegin()
              for _i51 in xrange(_size47):
                _elem52 = iprot.readDouble()
                _elem46.append(_elem52)
              iprot.readListEnd()
              _elem40.append(_elem46)
            iprot.readListEnd()
            self.inputData.append(_elem40)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('precit_args')
    if self.inputData is not None:
      oprot.writeFieldBegin('inputData', TType.LIST, 1)
      oprot.writeListBegin(TType.LIST, len(self.inputData))
      for iter53 in self.inputData:
        oprot.writeListBegin(TType.LIST, len(iter53))
        for iter54 in iter53:
          oprot.writeListBegin(TType.DOUBLE, len(iter54))
          for iter55 in iter54:
            oprot.writeDouble(iter55)
          oprot.writeListEnd()
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.inputData)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)

class precit_result:
  """
  Attributes:
   - success
  """

  thrift_spec = (
    (0, TType.LIST, 'success', (TType.LIST,(TType.DOUBLE,None)), None, ), # 0
  )

  def __init__(self, success=None,):
    self.success = success

  def read(self, iprot):
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.LIST:
          self.success = []
          (_etype59, _size56) = iprot.readListBegin()
          for _i60 in xrange(_size56):
            _elem61 = []
            (_etype65, _size62) = iprot.readListBegin()
            for _i66 in xrange(_size62):
              _elem67 = iprot.readDouble()
              _elem61.append(_elem67)
            iprot.readListEnd()
            self.success.append(_elem61)
          iprot.readListEnd()
        else:
          iprot.skip(ftype)
      else:
        iprot.skip(ftype)
      iprot.readFieldEnd()
    iprot.readStructEnd()

  def write(self, oprot):
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
      return
    oprot.writeStructBegin('precit_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.LIST, 0)
      oprot.writeListBegin(TType.LIST, len(self.success))
      for iter68 in self.success:
        oprot.writeListBegin(TType.DOUBLE, len(iter68))
        for iter69 in iter68:
          oprot.writeDouble(iter69)
        oprot.writeListEnd()
      oprot.writeListEnd()
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  def __hash__(self):
    value = 17
    value = (value * 31) ^ hash(self.success)
    return value

  def __repr__(self):
    L = ['%s=%r' % (key, value)
      for key, value in self.__dict__.iteritems()]
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

  def __eq__(self, other):
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

  def __ne__(self, other):
    return not (self == other)
# # Autogenerated by Thrift Compiler (0.9.3) # # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING # #  options string: py # Parameters:      - inputData      - targets      - epochSize      - batchSize Parameters:      - inputData Parameters:      - inputData      - targets      - epochSize      - batchSize Parameters:      - inputData # HELPER FUNCTIONS AND STRUCTURES Attributes:    - inputData    - targets    - epochSize    - batchSize # 0 # 1 # 2 # 3 # 4 Attributes:    - inputData # 0 # 1 Attributes:    - success # 0