class_docstr: HolidayCalendar implementation.
  
  Requires the calendar to be bounded. Constructs tables of precomputed values
  of interest for each day in the calendar, which enables better performance
  compared to a more flexible UnboundedHolidayCalendar.
  
  Each instance should be used in the context of only one graph. E.g. one can't
  create a BoundedHolidayCalendar in one tf.function and reuse it in another.
class_docstr_tok: ["HolidayCalendar","implementation",".","Requires","the","calendar","to","be","bounded",".","Constructs","tables","of","precomputed","values","of","interest","for","each","day","in","the","calendar",",","which","enables","better","performance","compared","to","a","more","flexible","UnboundedHolidayCalendar",".","Each","instance","should","be","used","in","the","context","of","only","one","graph",".","E.g",".","one","can't","create","a","BoundedHolidayCalendar","in","one","tf.function","and","reuse","it","in","another","."]
docstr: Initializer.
  
  Args:
    weekend_mask: Tensor of 7 elements, where "0" means work day and "1" -
      day off. The first element is Monday. By default, no weekends are
      applied. Some of the common weekend patterns are defined in
      `dates.WeekendMask`.
      Default value: None which maps to no weekend days.
    holidays: Defines the holidays that are added to the weekends defined by
    `weekend_mask`. An instance of `dates.DateTensor` or an object
     convertible to `DateTensor`.
     Default value: None which means no holidays other than those implied by
     the weekends (if any).
    start_year: Integer giving the earliest year this calendar includes. If
      `holidays` is specified, then `start_year` and `end_year` are ignored,
      and the boundaries are derived from `holidays`. If `holidays` is `None`,
      both `start_year` and `end_year` must be specified.
    end_year: Integer giving the latest year this calendar includes. If
      `holidays` is specified, then `start_year` and `end_year` are ignored,
      and the boundaries are derived from `holidays`. If `holidays` is `None`,
      both `start_year` and `end_year` must be specified.
docstr_tok: ["Initializer",".","Args",":","weekend_mask",":","Tensor","of","7","elements",",","where","``","0","''","means","work","day","and","``","1","''","-","day","off",".","The","first","element","is","Monday",".","By","default",",","no","weekends","are","applied",".","Some","of","the","common","weekend","patterns","are","defined","in","`","dates.WeekendMask","`",".","Default","value",":","None","which","maps","to","no","weekend","days",".","holidays",":","Defines","the","holidays","that","are","added","to","the","weekends","defined","by","`","weekend_mask","`",".","An","instance","of","`","dates.DateTensor","`","or","an","object","convertible","to","`","DateTensor","`",".","Default","value",":","None","which","means","no","holidays","other","than","those","implied","by","the","weekends","(","if","any",")",".","start_year",":","Integer","giving","the","earliest","year","this","calendar","includes",".","If","`","holidays","`","is","specified",",","then","`","start_year","`","and","`","end_year","`","are","ignored",",","and","the","boundaries","are","derived","from","`","holidays","`",".","If","`","holidays","`","is","`","None","`",",","both","`","start_year","`","and","`","end_year","`","must","be","specified",".","end_year",":","Integer","giving","the","latest","year","this","calendar","includes",".","If","`","holidays","`","is","specified",",","then","`","start_year","`","and","`","end_year","`","are","ignored",",","and","the","boundaries","are","derived","from","`","holidays","`",".","If","`","holidays","`","is","`","None","`",",","both","`","start_year","`","and","`","end_year","`","must","be","specified","."]
code: def __init__(
      self,
      weekend_mask=None,
      holidays=None,
      start_year=None,
      end_year=None,
  ):
      """Initializer.
  
      Args:
        weekend_mask: Tensor of 7 elements, where "0" means work day and "1" -
          day off. The first element is Monday. By default, no weekends are
          applied. Some of the common weekend patterns are defined in
          `dates.WeekendMask`.
          Default value: None which maps to no weekend days.
        holidays: Defines the holidays that are added to the weekends defined by
        `weekend_mask`. An instance of `dates.DateTensor` or an object
         convertible to `DateTensor`.
         Default value: None which means no holidays other than those implied by
         the weekends (if any).
        start_year: Integer giving the earliest year this calendar includes. If
          `holidays` is specified, then `start_year` and `end_year` are ignored,
          and the boundaries are derived from `holidays`. If `holidays` is `None`,
          both `start_year` and `end_year` must be specified.
        end_year: Integer giving the latest year this calendar includes. If
          `holidays` is specified, then `start_year` and `end_year` are ignored,
          and the boundaries are derived from `holidays`. If `holidays` is `None`,
          both `start_year` and `end_year` must be specified.
      """
      self._weekend_mask = tf.convert_to_tensor(
          weekend_mask or constants.WeekendMask.NONE
      )
      if holidays is None:
          self._holidays = None
      else:
          self._holidays = dt.convert_to_date_tensor(holidays)
      start_year, end_year = _resolve_calendar_boundaries(
          self._holidays, start_year, end_year
      )
      self._ordinal_offset = dt.from_year_month_day(
          start_year, 1, 1
      ).ordinal()
      self._calendar_size = (
          dt.from_year_month_day(end_year + 1, 1, 1).ordinal()
          - self._ordinal_offset
      )
  
      # Precomputed tables. These are constant 1D Tensors, mapping each day in the
      # [start_year, end_year] period to some quantity of interest, e.g. next
      # business day. The tables should be indexed with
      # `date.ordinal - self._offset`. All tables are computed lazily.
      # All tables have an extra element at the beginning and the end, see comment
      # in _compute_is_bus_day_table().
      self._table_cache = _TableCache()
  
imports: import attr
  import tensorflow.compat.v2
  from tf_quant_finance.datetime import constants
  from tf_quant_finance.datetime import date_tensor
  from tf_quant_finance.datetime import holiday_calendar
  from tf_quant_finance.datetime import periods
label_desc: Use image node_id 1 to create a new BoundedHolidayCalendar object from inherited base classes: holiday_calendar with example: obj = BoundedHolidayCalendar(weekend_mask, holidays, start_year, end_year)