ResultBuilders

Numpy

qianmoQqianmoQ· 更新于 2026-10-09· 阅读 2 分钟· 0 次阅读

登录后可跨设备保存划线和私人笔记登录

Numpy

class hamilton.base.NumpyMatrixResult[source]

Mixin for building a Numpy Matrix from the result of walking the graph.

All inputs to the build_result function are expected to be numpy arrays.

from hamilton import base, driver

adapter = base.SimplePythonGraphAdapter(base.NumpyMatrixResult())
dr = driver.Driver(config, *modules, adapter=adapter)
numpy_matrix = dr.execute([...], inputs=...)

static build_result(**outputs: dict[str, Any]) → matrix[source]

Builds a numpy matrix from the passed in, inputs.

Note: this does not check that the inputs are all numpy arrays/array like things.

Parameters:

outputs – function_name -> np.array.

Returns:

numpy matrix

评论

登录后参与评论

正在加载评论…