Exemple #1
0
def JobBuildAndInferCtx_GetStaticShape(job_name, lbn):
    job_name = str(job_name)
    lbn = str(lbn)
    axis_str = oneflow._oneflow_internal.JobBuildAndInferCtx_GetSerializedIdListAsStaticShape(
        job_name, lbn)
    int_list = text_format.Parse(axis_str, record_util.Int64List())
    return tuple(map(int, int_list.value))
Exemple #2
0
def JobBuildAndInferCtx_MirroredBlobGetStaticShape(job_name, lbn):
    job_name = str(job_name)
    lbn = str(lbn)
    get_shape = (
        oneflow_api.
        JobBuildAndInferCtx_MirroredBlobGetSerializedIdListAsStaticShape)
    axis_str = get_shape(job_name, lbn)
    int_list = text_format.Parse(axis_str, record_util.Int64List())
    return tuple(map(int, int_list.value))
Exemple #3
0
def JobBuildAndInferCtx_MirroredBlobGetStaticShape(job_name, lbn):
    job_name = str(job_name)
    lbn = str(lbn)
    get_shape = (
        oneflow_internal.
        JobBuildAndInferCtx_MirroredBlobGetSerializedIdListAsStaticShape)
    axis_str, error_str = get_shape(job_name, lbn)
    error = text_format.Parse(error_str, error_util.ErrorProto())
    if error.HasField("error_type"):
        raise JobBuildAndInferError(error)
    int_list = text_format.Parse(axis_str, record_util.Int64List())
    return tuple(map(int, int_list.value))
Exemple #4
0
def OneFlow_int64_feature(value):
    """Generate OFRecord int64 Feature

    Args:
        value ([type]): Input 1D int Array

    Returns:
        [type]: OFRecord int64 Feature
    """
    if not isinstance(value, (list, tuple)):
        value = [value]
    return ofrecord.Feature(int64_list=ofrecord.Int64List(value=value))
Exemple #5
0
def JobBuildAndInferCtx_GetStaticShape(job_name, lbn):
    job_name = str(job_name)
    lbn = str(lbn)
    (
        axis_str,
        error,
    ) = oneflow_api.JobBuildAndInferCtx_GetSerializedIdListAsStaticShape(
        job_name, lbn)
    if error.has_error_type():
        raise JobBuildAndInferCfgError(error)
    int_list = text_format.Parse(axis_str, record_util.Int64List())
    return tuple(map(int, int_list.value))
Exemple #6
0
def int64_feature(value):
    if not isinstance(value, (list, tuple)):
        value = [value]
    return ofrecord.Feature(int64_list=ofrecord.Int64List(value=value))