Esempio n. 1
0
 def test_get_timing(self):
     frame = TFFramework()
     frame.load(RunpyLoader, 'test/test_models/simple_nnet.py')
     assert frame.get_timing(
         mode='training') is not None, 'No timing returned.'
     assert frame.get_timing(
         mode='inference') is not None, 'No timing returned.'
Esempio n. 2
0
  def _run(self):
    frame = TFFramework()
    if self.args['list']:
      print 'Supported Exemplars:'
      for primop in frame.ExemplarRegistry:
        print ' ',primop
      return 0
    elif self.args['primop'] is None:
      self.subparser.error('A primop must be specified unless using --list')

    primop_t = self.args['primop']
    uas = UniformArgSampler()
    primop_args = uas.sample(primop_t, n=self.args['n'], seed=self.args['seed'])
    Exemplar = frame.ExemplarRegistry.lookup(primop_t)
    self.features = Features()
    for p_args in primop_args:
      exemplar = Exemplar(p_args)
      synthmodel = frame.SyntheticModel(exemplar)
      frame.set_model(synthmodel)
      profile = frame.get_timing(mode='inference', ops='native')
      graph = frame.get_graph(mode='inference', scope='dynamic', ops='native')
      id = graph.get_vertex_id_from_tf_name( exemplar.get_op_name() )
      self.features.append( p_args, profile[id][0] )

    if self.args['output'] is None:
      self.args['output'] = str(primop_t)+'.features'
    self.features.write(self.args['output'])
Esempio n. 3
0
 def test_datatag_timing_all_dynamic_primitive(self, model, mode):
     frame = TFFramework(RunpyLoader, model)
     t = frame.get_timing(mode, 'primitive')
     assert len(t) > 0, 'No timing information in profile.'