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})"
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})"
def _numpycode(self, printer: NumPyPrinter, *args: Any) -> str: shape = printer._print(self.args[0]) return f"len({shape})"
def _numpycode(self, printer: NumPyPrinter, *args: Any) -> str: return printer._print(self.evaluate())