Model

Neurocean大约 3 分钟

Model

Model Objects

class Model(Node)

模型, 模型是一个基础类,是所有模型的基础

  1. 提供了操作管理,参数管理的功能;
  2. 提供了端口管理的功能,快速访问模型端口;

addMonitor

def addMonitor(paramName, windows=0)

addMonitor(self: ocean.ocean.Model, paramName: str, windows: float = 0) -> None

添加变量监控

Parameter paramName: 参数名称

Parameter windows: 缓冲区窗口大小, 为0表示按需进行进行创建

addMonitors

def addMonitors(monitors, windows=0)

addMonitors(self: ocean.ocean.Model, monitors: list, windows: float = 0) -> None

批量添加变量监控

Parameter monitors: 变量列表

Parameter windows: 缓冲区窗口大小, 为0表示按需进行进行创建

getCapture

@staticmethod
def getCapture(*args, **kwargs)

getCapture(self: ocean.ocean.Model, paramName: str) -> ocean::CaptureBuffer

获取变量监控结果

Parameter paramName: 变量名称

Returns:

捕获结果

getCaptures

@staticmethod
def getCaptures(*args, **kwargs)

getCaptures(self: ocean.ocean.Model, captures: list) -> std::vector<ocean::CaptureBuffer, std::allocatorocean::CaptureBuffer >

批量获取变量监控

Parameter captures: 变量列表

Returns:

捕获结果列表

getParam

def getParam(paramName)

getParam(self: ocean.ocean.Model, paramName: str) -> ocean.ocean.Variable

根据参数名称获取变量

Parameter paramName: 参数名称

Returns:

参数实例

  • None 表示变量不存在
  • other 参数实例

getStatus

def getStatus(variableName)

getStatus(self: ocean.ocean.Model, variableName: str) -> ocean.ocean.TensorVariable

据参数名称张量变量

Parameter variableName: 变量名称

Returns:

参数实例

  • None 表示变量不存在
  • other 参数实例

input

def input(name)

input(self: ocean.ocean.Model, name: str) -> ocean.ocean.Input

根据端口名称获取输入端口

Parameter name: 端口名称

Returns:

端口指针

  • Node 表示端口不存在
  • other 端口指针

mat

def mat(name)

mat(self: ocean.ocean.Model, name: str) -> ocean.ocean.Connection

根据端口名称获取连接端口

Parameter name: 端口名称

Returns:

端口指针

  • Node 表示端口不存在
  • other 端口指针

output

def output(name)

output(self: ocean.ocean.Model, name: str) -> ocean.ocean.Output

根据端口名称获取输出端口

Parameter name: 端口名称

Returns:

端口指针

  • Node 表示端口不存在
  • other 端口指针

ref

def ref(name)

ref(self: ocean.ocean.Model, name: str) -> ocean.ocean.Reference

根据端口名称获取引用端口

Parameter name: 端口名称

Returns:

端口指针

  • Node 表示端口不存在
  • other 端口指针

removeMonitor

def removeMonitor(paramName)

removeMonitor(self: ocean.ocean.Model, paramName: str) -> None

移除变量监控

Parameter paramName: 变量名称

removeMonitors

def removeMonitors(monitors)

removeMonitors(self: ocean.ocean.Model, monitors: list) -> None

批量移除变量监控

Parameter monitors: 变量列表

setStatus

def setStatus(variableName, status)

setStatus(self: ocean.ocean.Model, variableName: str, status: object) -> bool

根据参数名称设置张量变量

**Note:**若设置对象为填充器, 设置不会立即生效,如果模型已经完成初始化,设置将不会被使用

Parameter variableName: 变量名称

Parameter filler: 填充器, 可以是张量,字符串,数值及通用对象,将自动进行转换

Returns:

是否设置成功:

  • True 成功
  • False 失败

operation

操作名称

**Note:**模型类型的标识,不同模型,操作名称不同

step

计算步长,步长是两次计算间的周期

Returns:

计算步长

上次编辑于:
贡献者: damone