treeflow.tree.rooted.tensorflow_rooted_tree module

class treeflow.tree.rooted.tensorflow_rooted_tree.TensorflowRootedTree(tree_or_first_arg: AbstractRootedTreeAttrs | object | None = None, *args, **kwargs)

Bases: TensorflowRootedTreeAttrs

UnrootedTreeType

alias of TensorflowUnrootedTree

property heights: Tensor
property branch_lengths: Tensor
property root_height: Tensor
numpy() NumpyRootedTree
with_node_heights(node_heights: Tensor) TensorflowRootedTree
get_unrooted_tree() TUnrootedTreeType
node_heights: Tensor
sampling_times: Tensor
property taxon_count: TShapeType
property taxon_set: TaxonSet | None
topology: TensorflowTreeTopology
treeflow.tree.rooted.tensorflow_rooted_tree.convert_tree_to_tensor(numpy_tree: NumpyRootedTree, height_dtype: DType = tf.float64) TensorflowRootedTree

Convert a TreeFlow tree composed to Numpy arrays to one composed of TensorFlow Tensors

Parameters:
  • numpy_tree (NumpyRootedTree) – Tree to convert

  • height_dtype (tf.DType) – TensorFlow datatype to use for tree times (defaults to TreeFlow default)

Returns:

Tree with arrays converted to Tensors

Return type:

TensorflowRootedTree

treeflow.tree.rooted.tensorflow_rooted_tree.tree_from_arrays(node_heights: ndarray | Tensor, parent_indices: ndarray | Tensor, sampling_times: ndarray | Tensor | None, taxon_set: TaxonSet | None = None, height_dtype: DType = tf.float64) TensorflowRootedTree