add_len for Var

This commit is contained in:
li-xl 2020-12-15 15:17:04 +08:00 committed by Dun Liang
parent 3b4430906d
commit d7cad0ca82
1 changed files with 4 additions and 0 deletions

View File

@ -935,7 +935,10 @@ def format(v, spec):
return v.item().__format__(spec)
Var.__format__ = format
def get_len(var):
return var.shape[0]
Var.__len__ = get_len
int = int32
Var.int = Var.int32
float = float32
@ -952,3 +955,4 @@ from . import contrib
from . import numpy2cupy
from .contrib import concat
from .misc import *
from . import sparse