def compile(self, root_block_like):
"""Compiles a block, and sets it to the root.
Args:
root_block_like: A block or an object that can be converted to a block by
[`td.convert_to_block`](#td.convert_to_block). Must have at least one
output or metric tensor. The output type may not contain any
Sequence or PyObject types.
Returns:
`self`
Raises:
RuntimeError: If `init_loom()` has already been called.
TypeError: If `root_block_like` cannot be converted to a block.
TypeError: If `root_block_like` fails to compile.
TypeError: If `root_block_like` has no output or metric tensors.
TypeError: If `root_block_like` has an invalid output type.
"""
if self.is_loom_initialized:
raise RuntimeError('Loom has already been initialized.')
return self._setup(root_block_like, interactive_mode=False)
评论列表
文章目录