提交 ae6745f7 编写于 作者: W wuzewu

fix py2 bug

上级 d0f8cbcc
......@@ -25,15 +25,33 @@ from paddlehub.module import module_desc_pb2
from paddlehub.common.utils import from_pyobj_to_module_attr, from_module_attr_to_pyobj
from paddlehub.common.logger import logger
dtype_map = {
fluid.core.VarDesc.VarType.FP32: "float32",
fluid.core.VarDesc.VarType.FP64: "float64",
fluid.core.VarDesc.VarType.FP16: "float16",
fluid.core.VarDesc.VarType.INT32: "int32",
fluid.core.VarDesc.VarType.INT16: "int16",
fluid.core.VarDesc.VarType.INT64: "int64",
fluid.core.VarDesc.VarType.BOOL: "bool",
fluid.core.VarDesc.VarType.INT16: "int16",
fluid.core.VarDesc.VarType.UINT8: "uint8",
fluid.core.VarDesc.VarType.INT8: "int8",
}
def convert_dtype_to_string(dtype):
if dtype in dtype_map:
return dtype_map[dtype]
raise TypeError("dtype shoule in %s" % list(dtype_map.keys()))
def get_variable_info(var):
if not isinstance(var, fluid.framework.Variable):
raise TypeError("var shoule be an instance of fluid.framework.Variable")
var_info = {
'type': var.type,
'name': var.name,
'dtype': var.dtype,
'dtype': convert_dtype_to_string(var.dtype),
'lod_level': var.lod_level,
'shape': var.shape,
'stop_gradient': var.stop_gradient,
......
......@@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
""" PaddleHub version string """
hub_version = "0.4.8.beta"
hub_version = "0.5.1"
module_proto_version = "1.0.0"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册