class_docstr: The "sawbridge": B(t) = t - 1(t > Z), where Z is uniform over [0,1].
  
  The stationary sawbridge is B(t + V mod 1), where V is uniform over [0,1] and
  Z, V are independent.
class_docstr_tok: ["The","``","sawbridge","''",":","B","(","t",")","=","t","-","1","(","t",">","Z",")",",","where","Z","is","uniform","over","[","0,1","]",".","The","stationary","sawbridge","is","B","(","t","+","V","mod","1",")",",","where","V","is","uniform","over","[","0,1","]","and","Z",",","V","are","independent","."]
code: def _sample_n(self, n, seed=None):
      if self.drop is None:
          uniform = tf.random.stateless_uniform(
              (self.order, n, 1), seed=seed, dtype=self.dtype
          )
      else:
          uniform = tf.fill(
              (self.order, n, 1),
              tf.constant(self.drop, dtype=self.dtype),
          )
      ind = self.index_points
      if self.stationary:
          if self.phase is None:
              phase = tf.random.stateless_uniform(
                  (n, 1), seed=seed, dtype=self.dtype
              )
          else:
              phase = tf.constant(self.phase, dtype=self.dtype)
          ind += phase
          ind %= 1.0
      less = tf.less(uniform, ind)  # shape: (order, n, time)
      # Note:
      # ind[n] == 1 -> sample[n] == 0 always
      # ind[n] == 0 -> sample[n] == 0 always
      sample = ind - tf.reduce_sum(tf.cast(less, self.dtype), 0)
      # Divide by sqrt(order).
      sample *= self.order**-0.5
      return sample
  
file_path: compression/models/toy_sources/sawbridge.py
imports: import tensorflow
  import tensorflow_probability
label_desc: Use image node_id 11 for calling the Sawbridge obj's underlying member method code with example usage: obj._sample_n(n, seed) and returns: sample