Exemplo n.º 1
0
import module

module.make_pizza(16, "pepperoni")
module.make_pizza(12, "mushroom", "green peppers", "extra cheese")


# importing specific functions
from module import make_pizza
make_pizza(16, "pepperoni")
make_pizza(12, "mushroom", "green peppers", "extra cheese")


# using as to give a function an alias
from module import make_pizza as mp
mp(16, "pepperoni")
mp(12, "mushroom", "green peppers", "extra cheese")

# using as to give a module an alias
import module as p
p.make_pizza(16, "pepperoni")
p.make_pizza(12, "mushroom", "green peppers", "extra cheese")

# importing all functions in a module
from module import *
make_pizza(16, "peppers")
make_pizza(12, "mushroom", "green peppers", "extra cheese")
Exemplo n.º 2
0
def c7m3d4(in_layer, name, idx, filters, act, batch_norm=False): #pre-process conv+maxpool size down 4x
    ca_f=cvbnac if batch_norm else cvac
    x=ca_f(in_layer,name+'_c7d2',idx=idx,fs=filters,act=act,size=7,stride=2)
    x=mp(x,name+'_m3d2',idx=idx,fs=None,act=None,size=3,stride=2)
    return x
Exemplo n.º 3
0
def c3t2mp(in_layer, name, idx, filters=3, act='relu'):
    x=cvac(in_layer,name+'_2',idx,filters,act)
    x=cvac(x,name+'_1',idx,filters,act)
    return mp(x,name,idx=idx,fs=None,act=None,size=2,stride=2)
Exemplo n.º 4
0
#如果要导入的函数的名称可能与程序中现有的名称冲突,或者函数的名称太长,可指定简短而独一无二的别名——函数的另一个名称,类似于外号。
#关键字as将函数重命名为你提供的别名
#指定别名的通用语法如下:
#from module_name import function_name as fn
from module import make_pizza as mp

mp(16, 'pepperoni')
mp(12, 'mushrooms', 'green peppers', 'extra cheese')