Beispiel #1
0
 def test_graph_datatag_accessors(self):
     frame = TFFramework()
     frame.load(RunpyLoader, 'test/test_models/simple_nnet.py')
     assert frame.get_graph(
         mode='training') is not None, 'No training graph returned.'
     assert frame.get_graph(
         mode='inference') is not None, 'No inference graph returned.'
Beispiel #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'])
Beispiel #3
0
 def test_datatag_graph_all_dynamic_primitive(self, model, mode):
     frame = TFFramework(RunpyLoader, model)
     g = frame.get_graph(mode, 'dynamic', 'primitive')
     assert len(g.ops) > 0, 'No operations in graph.'