Shortcuts

Loss

class pybind11_ke.module.loss.Loss(*args: Any, **kwargs: Any)[源代码]

继承自 pybind11_ke.module.BaseModule,什么额外的属性都没有增加。

__call__(*args: Any, **kwargs: Any) Any

Call self as a function.

__init__()[源代码]

创建 Loss 对象。

static __new__(cls, *args: Any, **kwargs: Any) Any
__repr__() str

Return repr(self).

__weakref__

list of weak references to the object (if defined)

get_parameters(mode: str = 'numpy', param_dict: dict[str, Any] | None = None) dict[str, numpy.ndarray] | dict[str, list] | dict[str, torch.Tensor]

获得模型权重。

参数:
  • mode – 模型保存的格式,可以选择 numpylistTensor

  • param_dict (dict[str, Any] | None) – 可以选择从哪里获得模型权重。

返回:

模型权重字典。

返回类型:

dict[str, numpy.ndarray] | dict[str, list] | dict[str, torch.Tensor]

load_checkpoint(path: str)

加载模型权重。

参数:

path (str) – 模型保存的路径

load_parameters(path: str)

加载模型权重。

参数:

path (str) – 模型保存的路径

pi_const: torch.nn.parameter.Parameter

常数 pi

save_checkpoint(path: str)

保存模型权重。

参数:

path (str) – 模型保存的路径

save_parameters(path: str)

用 json 格式保存模型权重。

参数:

path (str) – 模型保存的路径

set_parameters(parameters: dict[str, Any])

加载模型权重。

参数:

parameters (dict[str, Any]) – 模型权重字典。

zero_const: torch.nn.parameter.Parameter

常数 0

Docs

Access comprehensive developer documentation for Pybind11-OpenKE

View Docs