tf_quant_finance.datetime.PeriodTensor

Last updated: 2023-03-16.

tf_quant_finance.datetime.PeriodTensor#

View source

Represents a tensor of time periods.

tf_quant_finance.datetime.PeriodTensor(
    quantity, period_type
)

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.

Attributes:#

  • rank

  • shape

Methods#

__add__

View source

__add__(
    other
)

Adds another PeriodTensor of the same type.

__getitem__

View source

__getitem__(
    key
)

Implements indexing.

__mul__

View source

__mul__(
    multiplier
)

Multiplies PeriodTensor by a Tensor of ints.

__sub__

View source

__sub__(
    other
)

Subtracts another PeriodTensor of the same type.

boolean_mask

View source

boolean_mask(
    mask, axis=None
)

See tf.boolean_mask.

broadcast_to

View source

broadcast_to(
    shape
)

See tf.broadcast_to.

concat

View source

@classmethod
concat(
    cls, tensor_wrappers, axis
)

See tf.concat.

expand_dims

View source

expand_dims(
    axis
)

See tf.expand_dims.

identity

View source

identity()

See tf.identity.

period_type

View source

period_type()

Returns the PeriodType of this PeriodTensor.

quantity

View source

quantity()

Returns the quantities tensor of this PeriodTensor.

reshape

View source

reshape(
    shape
)

See tf.reshape.

squeeze

View source

squeeze(
    axis=None
)

See tf.squeeze.

stack

View source

@classmethod
stack(
    cls, tensor_wrappers, axis=0
)

See tf.stack.

transpose

View source

transpose(
    perm=None
)

See tf.transpose.

where

View source

@classmethod
where(
    cls, condition, tensor_wrapper_1, tensor_wrapper_2
)

See tf.where. Only three-argument version is supported here.