1. 26 2月, 2019 3 次提交
    • T
      Remove implicit name scoping from `tf.Module`s. · e866995a
      Tom Hennigan 提交于
      After attempting to integrate `tf.Module` into existing codebases (e.g.
      `tf.keras`) we've found that the automatic name scoping is too invasive (e.g.
      changing op and variable names) and it is desirable to disable it ~everywhere.
      
      We propose that name scoping for `tf.Module` becomes opt-in:
      
      >>> class MyModule(tf.Module):
      ...
      ...   @tf.Module.with_name_scope
      ...   def auto_name_scope(self, x):
      ...     if not hasattr(self, 'w'):
      ...       self.w = tf.Variable(1., name='w')
      ...     return x * self.w
      ...
      ...   def manual_name_scope(self, x):
      ...     if not hasattr(self, 'w'):
      ...       with self.name_scope:
      ...         self.w = tf.Variable(1., name='w')
      ...     return x * self.w
      ...
      ...   def no_name_scope(self, x):
      ...     if not hasattr(self, 'w'):
      ...       self.w = tf.Variable(1., name='w')
      ...     return x * self.w
      
      We will move opt-out name scoping into Sonnet:
      
      >>> class MyModule(snt.Module):
      ...
      ...   def auto_name_scope(self, x):
      ...     if not hasattr(self, 'w'):
      ...       self.w = tf.Variable(1., name='w')
      ...     return x * self.w
      ...
      ...   @snt.no_name_scope
      ...   def no_name_scope(self, x):
      ...     if not hasattr(self, 'w'):
      ...       self.w = tf.Variable(1., name='w')
      ...     return x * self.w
      
      In TF2 name scopes are cosmetic and this should be less of a big deal. We might
      consider encouraging users who want to filter on names to instead use flatten
      to extract a state dictionary for their objects (c.f.
      https://github.com/tensorflow/community/pull/56#discussion_r255048762).
      
      I have moved the automatic name scoping logic (Metaclass etc) and associated
      tests into Sonnet 2.
      
      PiperOrigin-RevId: 235540184
      e866995a
    • B
      [XLA:TF] Enable argminmax test on CPU · ad76a4b3
      Benjamin Kramer 提交于
      It's not clear what this comment refers to, but it's from 2017 and the test
      just works.
      
      PiperOrigin-RevId: 235539638
      ad76a4b3
    • T
      Rename ReplicaLocalVariable to SyncOnReadVariable. · 72b4dc9d
      Tom Hennigan 提交于
      PiperOrigin-RevId: 235536186
      72b4dc9d
  2. 25 2月, 2019 16 次提交
  3. 24 2月, 2019 4 次提交
  4. 23 2月, 2019 17 次提交