parameters: (self, time)
return_statement: return window_offset, mod
docstring: Compute some features on the time value.
docstring_summary: Compute some features on the time value.
docstring_tokens: Compute some features on the time value .
function: def _compute_time_features(self, time):
      """Compute some features on the time value."""
      batch_size = array_ops.shape(time)[0]
      num_periods = len(self._periodicities)
      # Reshape to 3D.
      periods = constant_op.constant(
          self._periodicities, shape=[1, 1, num_periods, 1], dtype=time.dtype)
      time = array_ops.reshape(time, [batch_size, -1, 1, 1])
      window_offset = time / self._periodicities
      # Cast to appropriate type and scale to [0, 1) range
      mod = (math_ops.cast(time % periods, self.dtype) * self._buckets /
             math_ops.cast(periods, self.dtype))
      # Bucketize based on some fixed width intervals. For a value t and interval
      # [a, b), we return (t - a) if a <= t < b, else 0.
      intervals = array_ops.reshape(
          math_ops.range(self._buckets, dtype=self.dtype),
          [1, 1, 1, self._buckets])
      mod = nn_ops.relu(mod - intervals)
      mod = array_ops.where_v2(mod < 1.0, mod, array_ops.zeros_like(mod))
      return window_offset, mod
function_tokens: def _compute_time_features ( self , time ) : batch_size = array_ops . shape ( time ) [ 0 ] num_periods = len ( self . _periodicities ) # Reshape to 3D. periods = constant_op . constant ( self . _periodicities , shape = [ 1 , 1 , num_periods , 1 ] , dtype = time . dtype ) time = array_ops . reshape ( time , [ batch_size , - 1 , 1 , 1 ] ) window_offset = time / self . _periodicities # Cast to appropriate type and scale to [0, 1) range mod = ( math_ops . cast ( time % periods , self . dtype ) * self . _buckets / math_ops . cast ( periods , self . dtype ) ) # Bucketize based on some fixed width intervals. For a value t and interval # [a, b), we return (t - a) if a <= t < b, else 0. intervals = array_ops . reshape ( math_ops . range ( self . _buckets , dtype = self . dtype ) , [ 1 , 1 , 1 , self . _buckets ] ) mod = nn_ops . relu ( mod - intervals ) mod = array_ops . where_v2 ( mod < 1.0 , mod , array_ops . zeros_like ( mod ) ) return window_offset , mod