class_docstr: Represents a tensor of time periods.
class_docstr_tok: ["Represents","a","tensor","of","time","periods","."]
docstr: Initializer.
  
  Args:
    quantity: A Tensor of type tf.int32, representing the quantities
      of period types (e.g. how many months). Can be both positive and
      negative.
    period_type: A PeriodType (a day, a month, etc). Currently only one
      PeriodType per instance of PeriodTensor is supported.
  
  Example:
  ```python
  two_weeks = PeriodTensor(2, PeriodType.WEEK)
  
  months = [3, 6, 9, 12]
  periods = PeriodTensor(months, PeriodType.MONTH)
  ```
docstr_tok: ["Initializer",".","Args",":","quantity",":","A","Tensor","of","type","tf.int32",",","representing","the","quantities","of","period","types","(","e.g",".","how","many","months",")",".","Can","be","both","positive","and","negative",".","period_type",":","A","PeriodType","(","a","day",",","a","month",",","etc",")",".","Currently","only","one","PeriodType","per","instance","of","PeriodTensor","is","supported",".","Example",":","``","`","python","two_weeks","=","PeriodTensor","(","2",",","PeriodType.WEEK",")","months","=","[","3",",","6",",","9",",","12","]","periods","=","PeriodTensor","(","months",",","PeriodType.MONTH",")","``","`"]
code: def __init__(self, quantity, period_type):
      """Initializer.
  
      Args:
        quantity: A Tensor of type tf.int32, representing the quantities
          of period types (e.g. how many months). Can be both positive and
          negative.
        period_type: A PeriodType (a day, a month, etc). Currently only one
          PeriodType per instance of PeriodTensor is supported.
  
      Example:
      ```python
      two_weeks = PeriodTensor(2, PeriodType.WEEK)
  
      months = [3, 6, 9, 12]
      periods = PeriodTensor(months, PeriodType.MONTH)
      ```
      """
      self._quantity = tf.convert_to_tensor(
          quantity, dtype=tf.int32, name="pt_quantity"
      )
      self._period_type = period_type
  
imports: import tensorflow.compat.v2
  from tf_quant_finance.datetime import constants
  from tf_quant_finance.datetime import tensor_wrapper
label_desc: Use image node_id 1 to create a new PeriodTensor object from inherited base classes: tensor_wrapper with example: obj = PeriodTensor(quantity, period_type)