PredictionClient 类

AzureML 加速模型的评分客户端。

继承
builtins.object
PredictionClient

构造函数

PredictionClient(address: str, port: Optional[int] = None, use_ssl: bool = False, access_token: str = '', service_name: str = '', channel_shutdown_timeout: datetime.timedelta = datetime.timedelta(seconds=120))

参数

address
port
默认值: None
use_ssl
默认值: False
access_token
service_name
channel_shutdown_timeout
默认值: 0:02:00

方法

score_file

通过将文件字节作为字符串张量进行传递,对单个图像文件进行评分。

score_numpy_arrays

为 numpy 数组评分。

score_tensors

为张量评分。

score_file

通过将文件字节作为字符串张量进行传递,对单个图像文件进行评分。

score_file(path: str, input_name='images', outputs=None, timeout: float = 10.0)

参数

input_name
必需

用于发送张量的输入名称

outputs
默认值: images

指定要检索的输出张量名称的字符串或字符串列表。

path
默认值: None

要评分的图像文件的路径。

timeout
默认值: 10.0

超时(以秒为单位)。

返回

预测结果,已删除批处理维度。 对于输出字符串,为单个 numpy 数组。 对于输出列表,为 numpy 数组列表。

score_numpy_arrays

为 numpy 数组评分。

score_numpy_arrays(input_map, outputs=None)

参数

input_map
必需

要馈送以进行评分的 numpy 数组的张量名称字典

outputs
默认值: None

指定要检索的输出张量名称的字符串或字符串列表。

input_name
必需

用于发送数组的输入名称。

返回

具有预测值的 Numpy 数组。 对于输出字符串,为单个 numpy 数组。 对于输出列表,为 numpy 数组列表。

score_tensors

为张量评分。

score_tensors(input_map, outputs=None, timeout: float = 10.0)

参数

input_map
必需

映射张量名称以馈送元组 (data as bytes, shape as list[int], datatype as TensorFlow types_pb2) 的字典

outputs
默认值: None

指定要检索的输出张量名称的字符串或字符串列表。

timeout
默认值: 10.0

请求超时时间(以秒为单位)

返回

具有预测值的 Numpy 数组。 对于输出字符串,为单个 numpy 数组。 对于输出列表,为 numpy 数组列表。