python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
import json import ipyvuetify as v from .appLoader import AppLoader from .common import load_template # update the CSS a bit # get_ipython().run_cell_magic( # "HTML", # "", # "<style>\n.jp-Cell {\n margin:unset;\n padding: unset;\n}\n.jp-Cell:not(.jp-mod-noOutputs) .jp-Cell-outputWrapper{\n mar...
modulus-toolchain-master
mpc/nvapp/app.py
import ipyvuetify as v import traitlets as tr from .common import load_template, reload_module import ipywidgets as ipw import time class AppLoader(v.VuetifyTemplate): template = tr.Unicode(load_template("vue-templates/app-loader.vue")).tag(sync=True) apps = tr.List(["widget1", "widget2"]).tag(sync=True) ...
modulus-toolchain-master
mpc/nvapp/appLoader.py
from .app import new
modulus-toolchain-master
mpc/demoYAMLv1/__init__.py
import os, time import ipywidgets as ipw import ipyvuetify as v import time import traitlets as tr import os def load_template(filename): with open(os.path.join(os.path.dirname(__file__), filename)) as f: return f.read() var2name = {"lr": "Learning Rate"} var2hint = { "eps": "Numerical threshold b...
modulus-toolchain-master
mpc/demoYAMLv1/app.py
from .app import new
modulus-toolchain-master
mpc/mpc/__init__.py
import os, time import ipywidgets as ipw import ipyvuetify as v import time import traitlets as tr import os import sys sys.path.append(os.environ["MPC_PATH"] + "../mtc") print(sys.path) from mtc.config_utils import customize_schema, config2dictV2 def load_template(filename): with open(os.path.join(os.path.dir...
modulus-toolchain-master
mpc/mpc/app.py
from .app import new
modulus-toolchain-master
mpc/demoYAMLv2/__init__.py
import os, time import ipywidgets as ipw import ipyvuetify as v import time import traitlets as tr import os def load_template(filename): with open(os.path.join(os.path.dirname(__file__), filename)) as f: return f.read() var2name = {"lr": "Learning Rate"} var2hint = { "eps": "Numerical threshold b...
modulus-toolchain-master
mpc/demoYAMLv2/app.py
from cfg import * import numpy as np from sympy import exp, sin, cos, DiracDelta ########################################################## ####################### Neural networks ################## ########################################################## # Create NN to predict pressure (x,y,t) -> p [x, y, t], [pres...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-2d-fwd/solutions/we-fwd-2d-cv-snapshots-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Create NN to predict pressure (x,t) -> p [x, t], [u] = p.add_neural_network(name="pressure", inputs=["x", "t"], outputs=["u"]) # Create NN to predict velocity (x,t) -> vel [x], [vel] = p.add_neural_network(name="velocity", inputs=["x"], outputs=["vel"]...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-inv/solutions/we-inv-1d-vel-noderiv-problem.py
from cfg import * import numpy as np from sympy import exp, sin ################ Neural Network defintion ################ # Create NN to predict pressure (x,t) -> p [x, t], [u] = p.add_neural_network(name="pressure", inputs=["x", "t"], outputs=["u"]) # Create NN to predict velocity (x) -> vel [x], [vel] = p.add_neur...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-inv/solutions/we-inv-1d-vel-2layers-deriv-problem.py
from cfg import * import numpy as np from sympy import exp, sin ################ Neural Network defintion ################ # Create NN to predict pressure (x,t) -> p [x, t], [u] = p.add_neural_network(name="pressure", inputs=["x", "t"], outputs=["u"]) # Create NN to predict velocity (x) -> vel [x], [vel] = p.add_neu...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-inv/solutions/we-inv-1d-vel-3layers-deriv-problem.py
from cfg import * import numpy as np from sympy import exp, sin ################ Neural Network defintion ################ # Create NN to predict pressure (x,t) -> p [x, t], [u] = p.add_neural_network(name="pressure", inputs=["x", "t"], outputs=["u"]) # Create NN to predict velocity (x) -> vel [x], [vel] = p.add_neur...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-inv/solutions/we-inv-1d-vel-4layers-deriv-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Create NN to predict pressure (x,t) -> p [x, t], [u] = p.add_neural_network(name="pressure", inputs=["x", "t"], outputs=["u"]) # Create NN to predict velocity (x,t) -> vel [x], [vel] = p.add_neural_network(name="velocity", inputs=["x"], outputs=["vel"]...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-inv/solutions/we-inv-1d-vel-deriv-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Create NN to predict pressure (x,t) -> p [x, t], [u] = p.add_neural_network(name="pressure", inputs=["x", "t"], outputs=["u"]) # Create NN to predict velocity (x,t) -> vel [x], [vel] = p.add_neural_network(name="velocity", inputs=["x"], outputs=["vel"]...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-inv/solutions/we-inv-1d-vel-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Vel is also an input [x, t, vel], [u] = p.add_neural_network(name="wave1d", inputs=["x", "t", "vel"], outputs=["u"]) # Geometry + domains L = float(np.pi) geo = p.Line1D("geom", 0, L) interior = p.add_interior_subdomain("interior", geom=geo, params={...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-fwd/solutions/we-fwd-1d-vel-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Create NN that maps (position,time) -> pressure [x, t], [u] = p.add_neural_network(name="wave1d", inputs=["x", "t"], outputs=["u"]) # Geometry L = float(np.pi) geo = p.Line1D("geom", 0, L) # Domains # Do not forget to add the time parametrization in...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-fwd/solutions/we-fwd-1d-cv-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Neural net (position,time) -> pressure [x, t], [u] = p.add_neural_network(name="wave1d", inputs=["x", "t"], outputs=["u"]) # Geometry L = float(np.pi) geo = p.Line1D("geom", 0, L) # Domains + time parametrization interior = p.add_interior_subdomain("...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-fwd/solutions/we-fwd-1d-ncv-problem.py
from cfg import * import numpy as np from sympy import exp, sin # Vel is also an input [x, t, k], [u] = p.add_neural_network(name="wave1d", inputs=["x", "t", "k"], outputs=["u"]) # Geometry + domains L = float(np.pi) geo = p.Line1D("geom", 0, L) interior = p.add_interior_subdomain("interior", geom=geo, params={t:(0...
modulus-toolchain-master
examples/PINNs/04-WaveEquationPINNs/we-1d-fwd/solutions/we-fwd-1d-vel-k-problem.py
from cfg import * [x, y, rot], [u, pp, v] = p.add_neural_network( name="NN", inputs=["x", "y", "rot"], outputs=["u", "p", "v"] ) # geometry import numpy as np params = {rot: (0, -np.pi / 6)} # params = {rot: float(0.0)} channel_length = 15.0 / 2 channel_height = 10.0 / 2 a = 0.3 channel_rect = p.Rectangle( ...
modulus-toolchain-master
examples/PINNs/03-Airfoil/airfoil-custom-geom-problem.py
import numpy as np from modulus.geometry.primitives_2d import Channel2D, Rectangle import matplotlib.pyplot as plt import warp as wp import numpy as np import os wp.init() # Naca implementation modified from https://stackoverflow.com/questions/31815041/plotting-a-naca-4-series-airfoil # https://en.wikipedia.org/w...
modulus-toolchain-master
examples/PINNs/03-Airfoil/CustomAirfoilGeom.py
from cfg import * [x, y, rot], [u, pp, v] = p.add_neural_network( name="NN", inputs=["x", "y", "rot"], outputs=["u", "p", "v"] ) # geometry import numpy as np lines = [[0, 0], [1, 0], [1, 1]] from sympy import Number, Symbol, Heaviside, atan, sin, cos, sqrt # Naca implementation modified from https://stackove...
modulus-toolchain-master
examples/PINNs/03-Airfoil/airfoil_rot_only_problem.py
from cfg import * [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=geo_solid, criteria=y>0) bdr...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p1a.py
from cfg import * import sympy as sp # HEAT [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=g...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p2a.py
from cfg import * import sympy as sp # HEAT [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=g...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p2d.py
from cfg import * [x], [ua, ub] = p.add_neural_network(name="NN", inputs=["x"], outputs=["ua", "ub"]) geom = p.Line1D("geomA", -1,0) interior = p.add_interior_subdomain("interiorA", geom=geom) middle = p.add_boundary_subdomain("middle", geom=geom, criteria=Eq(x,0)) bdry = p.add_boundary_subdomain("bdryA", geom=geom...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/p2c.py
from cfg import * [x, y], [u] = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u"]) w,h = 2,1 r1 = p.Rectangle("r1", (0,0), (w,h)) ch1 = p.Channel2D("ch1", (0,0), (w,h)) inlet = p.add_boundary_subdomain("inlet", geom=r1, criteria=Eq(x,0)) outlet = p.add_boundary_subdomain("outlet", geom=r1, criteria=Eq...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s2p1a.py
from cfg import * [x, y], [u, v, pp] = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u", "v", "p"]) w,h = 2,1 r1 = p.Rectangle("r1", (0,0), (w,h)) ch1 = p.Channel2D("ch1", (0,0), (w,h)) subr = p.Rectangle("subr1", (w/2-.1,0), (w/2+.1,h*.8)) ch1 = p.GeometryDifference("gd", ch1, subr) inlet = p.add_bo...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s2p2e.py
from cfg import * [x], [ua, ub] = p.add_neural_network(name="NN", inputs=["x"], outputs=["ua", "ub"]) geom = p.Line1D("geomA", -1,0) interior = p.add_interior_subdomain("interiorA", geom=geom) middle = p.add_boundary_subdomain("middle", geom=geom, criteria=Eq(x,0)) bdry = p.add_boundary_subdomain("bdryA", geom=geom...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/p1c.py
from cfg import * [x], [ua, ub] = p.add_neural_network(name="NN", inputs=["x"], outputs=["ua", "ub"]) DA = 1 DB = 1/100 geom = p.Line1D("geomA", -1,0) interior = p.add_interior_subdomain("interiorA", geom=geom) middle = p.add_boundary_subdomain("middle", geom=geom, criteria=Eq(x,0)) bdry = p.add_boundary_subdomain...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/p2b.py
from cfg import * [x, y], [u, v, pp] = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u", "v", "p"]) w,h = 2,1 r1 = p.Rectangle("r1", (0,0), (w,h)) ch1 = p.Channel2D("ch1", (0,0), (w,h)) inlet = p.add_boundary_subdomain("inlet", geom=r1, criteria=Eq(x,0)) outlet = p.add_boundary_subdomain("outlet", geo...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s2p1c.py
from cfg import * [x], [ua, ub] = p.add_neural_network(name="NN", inputs=["x"], outputs=["ua", "ub"]) geom = p.Line1D("geomA", -1,0) interior = p.add_interior_subdomain("interiorA", geom=geom) bdry = p.add_boundary_subdomain("bdryA", geom=geom) diff_eq = Eq(ua.diff(x,2) + 1, 0) p.add_constraint("diffusionA", enforce(...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/p1a.py
from cfg import * [x, v1,v2], [va, vb] = p.add_neural_network(name="NN", inputs=["x", 'v1', 'v2'], outputs=["va", "vb"]) ua = p.add_submodel("ua", va*(x+1)+v1) ub = p.add_submodel("ub", vb*(x-1)+v2) params={v1:(-1,1), v2:(-1,1)} DA = 1 DB = 1/100 geom = p.Line1D("geomA", -1,0) interior = p.add_interior_subdomain("...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/p3a.py
from cfg import * [x, y, oh], [u, v, pp] = p.add_neural_network(name="NN", inputs=["x", "y", "oh"], outputs=["u", "v", "p"]) w,h = 2,1 r1 = p.Rectangle("r1", (0,0), (w,h)) ch1 = p.Channel2D("ch1", (0,0), (w,h)) params = {oh: (0,0.95)} # subr = p.Rectangle("subr1", (w/2-.1,0), (w/2+.1,h*.8)) subr = p.Rectangle("subr...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s2p3.py
from cfg import * [x, y], [u, v, pp] = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u", "v", "p"]) w,h = 2,1 r1 = p.Rectangle("r1", (0,0), (w,h)) ch1 = p.Channel2D("ch1", (0,0), (w,h)) subr = p.Rectangle("subr1", (w/2-.1,0), (w/2+.1,h*.8)) ch1 = p.GeometryDifference("gd", ch1, subr) inlet = p.add_bo...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s2p2c.py
from cfg import * import sympy as sp # HEAT [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=g...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p3.py
from cfg import * [x, y], [u, v, pp] = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u", "v", "p"]) w,h = 2,1 r1 = p.Rectangle("r1", (0,0), (w,h)) ch1 = p.Channel2D("ch1", (0,0), (w,h)) inlet = p.add_boundary_subdomain("inlet", geom=r1, criteria=Eq(x,0)) outlet = p.add_boundary_subdomain("outlet", geo...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s2p1b.py
from cfg import * import sympy as sp # HEAT [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=g...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p2c.py
from cfg import * import sympy as sp [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=geo_solid...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p1b.py
from cfg import * import sympy as sp # HEAT [x, y], [T] = p.add_neural_network(name="NN_Tsolid", inputs=["x", "y"], outputs=[ "Tsolid"]) geo_solid = p.Rectangle("rect", (0,0), (1,1)) interior_solid = p.add_interior_subdomain("interior_solid", geom=geo_solid) bdry_solid = p.add_boundary_subdomain("bdry_solid", geom=g...
modulus-toolchain-master
examples/PINNs/01-PracticeProblems/solutions/s3p2b.py
from cfg import * [x, y], sOuts = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u", "v"]) u, v = sOuts e_xx = p.add_submodel("epsilon_xx", u.diff(x)) e_yy = p.add_submodel("epsilon_yy", v.diff(y)) e_xy = p.add_submodel("epsilon_xy", 0.50 * u.diff(y) + 0.50 * v.diff(x)) # https://www.mathworks.com/mat...
modulus-toolchain-master
examples/PINNs/02-StructuralAnalysis/struct_2d_problem.py
from cfg import * [x, y, z, R], sOuts = p.add_neural_network( name="NN", inputs=["x", "y", "z", "R"], outputs=["u", "v", "w"] ) u, v, w = sOuts params = {R: (10, 20)} e_xx = p.add_submodel("epsilon_xx", u.diff(x)) e_yy = p.add_submodel("epsilon_yy", v.diff(y)) e_zz = p.add_submodel("epsilon_zz", w.diff(z)) e_xy...
modulus-toolchain-master
examples/PINNs/02-StructuralAnalysis/struct_3d_problem.py
modulus-toolchain-master
mtc/__init__.py
from sympy import Symbol, Function, Or, And, Eq, Abs, Integral, expand import sympy import os, sys def load_template(filename): with open(os.path.join(os.path.dirname(__file__), filename)) as f: return f.read() def load_yaml(filename): """Loads a YAML file using a path relative to where this module...
modulus-toolchain-master
mtc/problem.py
import click import os, sys # def load_template(filename): # with open(os.path.join(os.path.dirname(__file__), filename)) as f: # return f.read() MTC_ROOT = os.path.dirname(__file__) @click.group() def cli(): pass @cli.command() @click.argument("project-name") def create(project_name): """Creat...
modulus-toolchain-master
mtc/mtc.py
import os def load_yaml(filename): """Loads a YAML file using a path relative to where this module resides""" import yaml with open(os.path.join(os.path.dirname(__file__), filename)) as f: return yaml.safe_load(f) def load_config(path="./"): import yaml conf_path = os.path.join(path, "...
modulus-toolchain-master
mtc/config_utils.py
from sympy import Symbol, Function, Or, And, Eq, Abs, Integral, expand import sympy import sympy as sp from jinja2 import Template import os, sys import h5py def load_template(filename): import jinja2 as j path = os.path.join(os.path.dirname(__file__), "templates", "fno-problem") env = j.Environment(lo...
modulus-toolchain-master
mtc/fno_problem.py
modulus-toolchain-master
mtc/docs/__init__.py
import os from jinja2 import Template def load_template(filename): with open(os.path.join(os.path.dirname(__file__), filename)) as f: return f.read() def compile(problem): assert ( "x" in problem._vars and "y" in problem._vars ), "Problem geometry must be 2D or 3D" t_file = "warp_geo...
modulus-toolchain-master
mtc/compile/target_geometry.py
modulus-toolchain-master
mtc/compile/__init__.py
import warp as wp wp.init() ## SDF Helpers # subtraction @wp.func def op_subtract(d1: float, d2: float): return -wp.min(-d1, d2) # intersection @wp.func def op_intersect(d1: float, d2: float): return wp.max(d1, d2) # union @wp.func def op_union(d1: float, d2: float): return wp.min(d1, d2) # signed sph...
modulus-toolchain-master
mtc/compile/templates/warp_geometry.py
import warp as wp wp.init() ## Custom Code (from problem.py) {{custom_warp_code}} ## SDF Helpers # subtraction @wp.func def op_subtract(d1: float, d2: float): return -wp.min(-d1, d2) # intersection @wp.func def op_intersect(d1: float, d2: float): return wp.max(d1, d2) # union @wp.func def op_union(d1: fl...
modulus-toolchain-master
mtc/compile/templates/warp_geometry_2d.py
def make_infer_fn(outputs=[{% for item in _submodels %}'{{ item }}',{% endfor %}]): coll_models=[{% for item in coll_models %}'{{ item }}',{% endfor %}] invals = {str(v): np.array([0]).reshape(-1, 1) for v in [{% for item in _vars %}'{{ item }}',{% endfor %}]} # requires_grad = False requires_gra...
modulus-toolchain-master
mtc/templates/inference_section.py
from mtc.problem import PINNProblem from mtc.fno_problem import FNOProblem from mtc.problem import * PINN = PINNProblem("[PINN] %%projname%%") FNO = FNOProblem("[PINO] %%projname%%") PINO = FNO p = PINN
modulus-toolchain-master
mtc/templates/cfg.py
from modulus.sym.solver import Solver from modulus.sym.domain import Domain from modulus.sym.geometry.primitives_1d import Line1D, Point1D from modulus.sym.geometry.primitives_2d import Rectangle, Circle, Polygon, Line, Channel2D from modulus.sym.geometry.primitives_3d import Box, Sphere, Cylinder from modulus.sym.dom...
modulus-toolchain-master
mtc/templates/train-imports.py
from cfg import * # Select Problem Type p = PINN # p = FNO # uncomment to select a PINO/FNO problem type # ------------------- # Suggested structure (PINN) # # 1. Define problem variables and unknown functions; e.g., # [x, y], [u] = p.add_neural_network(name="NN", inputs=["x", "y"], outputs=["u"]) # # 2. Define g...
modulus-toolchain-master
mtc/templates/problem.py
from typing import Dict import modulus from modulus.sym.hydra import instantiate_arch, ModulusConfig from modulus.sym.key import Key from modulus.sym.node import Node from modulus.sym.solver import Solver from modulus.sym.domain import Domain from modulus.sym.domain.constraint import SupervisedGridConstraint from mod...
modulus-toolchain-master
mtc/templates/fno-problem/train.py
from typing import Dict # import modulus from modulus.sym.hydra import instantiate_arch, ModulusConfig from modulus.sym.key import Key from modulus.sym.node import Node from modulus.sym.graph import Graph from modulus.sym.solver import Solver from modulus.sym.domain import Domain from modulus.sym.domain.constraint im...
modulus-toolchain-master
mtc/templates/fno-problem/infer.py
class FNOEquationConstraint(torch.nn.Module): "Custom Equation Constraint" def __init__(self, vars, gridvarfuncs, eq_srepr, outvar, onFunc, dirichlet_gen_conds, dirichlet_conds, neumann_conds, ctype="interior", criteria=None): "ctype in ['interior', 'boundary']" ctypes=['interior', 'boundary'] ...
modulus-toolchain-master
mtc/templates/fno-problem/constraints.py
modulus-toolchain-master
mtc/templates/conf/__init__.py
from __future__ import print_function from setuptools import setup, find_packages, Command from setuptools.command.sdist import sdist from setuptools.command.build_py import build_py from setuptools.command.egg_info import egg_info from subprocess import check_call import os import sys import platform here = os.path.d...
ipyparaview-master
setup.py
# Module version version_info = (0, 1, 2, 'beta', 0) # Module version stage suffix map _specifier_ = {'alpha': 'a', 'beta': 'b', 'candidate': 'rc', 'final': ''} # Module version accessible using ipyparaview.__version__ __version__ = '%s.%s.%s%s'%(version_info[0], version_info[1], version_info[2], '' if version_info...
ipyparaview-master
ipyparaview/_version.py
import math import numpy as np __all__ = ['rotateCameraTurntable', 'panCameraTurntable', 'zoomCameraTurntable'] def _normalize(v): return v/np.linalg.norm(v) def _cartToSphr(p): #cartesian position into spherical r = np.linalg.norm(p) return np.array([r, math.atan2(p[0], p[2]), math.a...
ipyparaview-master
ipyparaview/camera_models.py
############################################################################### # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
ipyparaview-master
ipyparaview/__init__.py
############################################################################### # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at...
ipyparaview-master
ipyparaview/widgets.py
#!/usr/bin/env python # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Un...
mlperf-common-main
setup.py
# Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless require...
mlperf-common-main
mlperf_common/logging.py
mlperf-common-main
mlperf_common/__init__.py
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
mlperf-common-main
mlperf_common/scaleoutbridge.py
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
mlperf-common-main
mlperf_common/frameworks/mxnet.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
mlperf-common-main
mlperf_common/frameworks/base_mpi.py
mlperf-common-main
mlperf_common/frameworks/__init__.py
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
mlperf-common-main
mlperf_common/frameworks/hugectr.py
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by ...
mlperf-common-main
mlperf_common/frameworks/base.py
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
mlperf-common-main
mlperf_common/frameworks/pyt.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # import enum import os.path import shutil import functools import operator import collections from library import * ################################################################################################### # # Data structure model...
cutlass-main
tools/library/scripts/gemm_operation.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # import re ################################################################################################### import enum # The following block implements enum.auto() for Python 3.5 variants that don't include it such # as the default 3.5...
cutlass-main
tools/library/scripts/library.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # import enum import os.path import shutil from library import * from gemm_operation import * from rank_k_operation import * from rank_2k_operation import * from trmm_operation import * from symm_operation import * from conv2d_operation impor...
cutlass-main
tools/library/scripts/manifest.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil import functools import operator from library import * ################################################################################################### # # Data structure modeling a Rank K up...
cutlass-main
tools/library/scripts/rank_k_operation.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
tools/library/scripts/rt.py
cutlass-main
tools/library/scripts/__init__.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil from library import * ################################################################################################### # class Conv2dOperation: # def __init__(self, conv_kind, iterator_alg...
cutlass-main
tools/library/scripts/conv2d_operation.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # import enum import os.path import shutil import argparse import logging from library import * from manifest import * from itertools import product ############################################################################################...
cutlass-main
tools/library/scripts/generator.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil from library import * ################################################################################################### # class Conv3dOperation: # def __init__(self, conv_kind, iterator_alg...
cutlass-main
tools/library/scripts/conv3d_operation.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil import functools import operator from library import * ################################################################################################### # # Data structure modeling a Rank K up...
cutlass-main
tools/library/scripts/rank_2k_operation.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil import functools import operator from library import * ################################################################################################### # # Data structure modeling a Symm upda...
cutlass-main
tools/library/scripts/symm_operation.py
# # \file generator.py # # \brief Generates the CUTLASS Library's instances # # import enum import os.path import shutil import functools import operator from library import * ################################################################################################### # # Data structure modeling a TRMM oper...
cutlass-main
tools/library/scripts/trmm_operation.py
# Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain...
cutlass-main
test/unit/gemm/device/simt_sm50.py
################################################################################################# # # Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/interface/gemm_interface.py
################################################################################################# # # Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/interface/conv2d_interface.py
################################################################################################# # # Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/interface/utils.py
################################################################################################# # # Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/conv2d/conv2d_sm80.py
################################################################################################# # # Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/conv2d/conv2d_test_utils.py
################################################################################################# # # Copyright (c) 2023 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/conv2d/run_all_tests.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/backend/conv/conv2d_dgrad_implicit_gemm_tf32nhwc_tf32nhwc_f32nhwc_tensor_op_f32_sm80.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/backend/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/backend/conv/conv2d_dgrad_implicit_gemm_f16nhwc_f16nhwc_f16nhwc_tensor_op_f16_sm80.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/backend/conv/conv2d_strided_dgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/backend/conv/conv2d_fprop_few_channels_f16nhwc_f16nhwc_f16nhwc_tensor_op_f32_sm80.py
################################################################################################# # # Copyright (c) 2017 - 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # # Redistribution and use in source and binary forms, with or without # modification, are permitt...
cutlass-main
test/python/backend/conv/conv2d_wgrad_implicit_gemm_f16nhwc_f16nhwc_f32nhwc_tensor_op_f32_sm80.py