示例#1
0
 def _numpycode(self, printer: NumPyPrinter, *args: Any) -> str:
     printer.module_imports[printer._module].add("sum")
     array = printer._print(self.array)
     axis = printer._print(self.axis)
     return f"sum({array}, axis={axis})"
示例#2
0
 def _numpycode(self, printer: NumPyPrinter, *args: Any) -> str:
     printer.module_imports[printer._module].add("zeros")
     shape = printer._print(self.args[0])
     return f"zeros({shape})"
示例#3
0
 def _numpycode(self, printer: NumPyPrinter, *args: Any) -> str:
     shape = printer._print(self.args[0])
     return f"len({shape})"
示例#4
0
 def _numpycode(self, printer: NumPyPrinter, *args: Any) -> str:
     return printer._print(self.evaluate())