Last updated: 2023-03-16.
tf_quant_finance.datetime.PeriodTensor#
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:#
rankshape
Methods#
__add__
__add__(
other
)
Adds another PeriodTensor of the same type.
__getitem__
__getitem__(
key
)
Implements indexing.
__mul__
__mul__(
multiplier
)
Multiplies PeriodTensor by a Tensor of ints.
__sub__
__sub__(
other
)
Subtracts another PeriodTensor of the same type.
boolean_mask
boolean_mask(
mask, axis=None
)
See tf.boolean_mask.
broadcast_to
broadcast_to(
shape
)
See tf.broadcast_to.
concat
@classmethod
concat(
cls, tensor_wrappers, axis
)
See tf.concat.
expand_dims
expand_dims(
axis
)
See tf.expand_dims.
identity
identity()
See tf.identity.
period_type
period_type()
Returns the PeriodType of this PeriodTensor.
quantity
quantity()
Returns the quantities tensor of this PeriodTensor.
reshape
reshape(
shape
)
See tf.reshape.
squeeze
squeeze(
axis=None
)
See tf.squeeze.
stack
@classmethod
stack(
cls, tensor_wrappers, axis=0
)
See tf.stack.
transpose
transpose(
perm=None
)
See tf.transpose.
where
@classmethod
where(
cls, condition, tensor_wrapper_1, tensor_wrapper_2
)
See tf.where. Only three-argument version is supported here.