prompt
stringlengths
94
42.6k
completion
stringlengths
6
120
api
stringlengths
14
68
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
fake_quant_tensor(x, qmin, qmax, q_dict)
megengine.quantization.utils.fake_quant_tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
tensor(inp_data, dtype=np.float32)
megengine.tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
Grad()
megengine.core.autodiff.grad.Grad
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
make_shape_tuple(x.grad.shape)
megengine.core.tensor.utils.make_shape_tuple
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
make_shape_tuple(x1.grad.shape)
megengine.core.tensor.utils.make_shape_tuple
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
fake_quant_tensor(inp, qmin, qmax, q_dict)
megengine.quantization.utils.fake_quant_tensor
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
Grad()
megengine.core.autodiff.grad.Grad
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
Grad()
megengine.core.autodiff.grad.Grad
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.reshape(x, (n, c, -1, k1 * k2))
megengine.functional.reshape
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.transpose(x, (0, 1, 3, 2))
megengine.functional.transpose
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.reshape(x, (n, c * k1 * k2, -1))
megengine.functional.reshape
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.reshape(mask, (N, 1, 9, rate, rate, H, W))
megengine.functional.reshape
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.softmax(mask, axis=2)
megengine.functional.softmax
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.reshape(up_flow, (N, 2, 9, 1, 1, H, W))
megengine.functional.reshape
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.sum(mask * up_flow, axis=2)
megengine.functional.sum
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.transpose(up_flow, (0, 1, 4, 2, 5, 3))
megengine.functional.transpose
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.reshape(up_flow, (N, 2, rate * H, rate * W))
megengine.functional.reshape
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.zeros([N, 1, H, W], dtype="float32")
megengine.functional.zeros
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.zeros([N, 1, H, W], dtype="float32")
megengine.functional.zeros
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
amp.autocast(enabled=self.mixed_precision)
megengine.amp.autocast
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
amp.autocast(enabled=self.mixed_precision)
megengine.amp.autocast
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(fmap1, 2, stride=2)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(fmap2, 2, stride=2)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.split(fmap1, [hdim], axis=1)
megengine.functional.split
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.tanh(net)
megengine.functional.tanh
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.relu(inp)
megengine.functional.relu
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(net, 2, stride=2)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(inp, 2, stride=2)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(fmap1, 4, stride=4)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(fmap2, 4, stride=4)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(net, 4, stride=4)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.avg_pool2d(inp, 4, stride=4)
megengine.functional.avg_pool2d
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.concat([_x, _y], axis=1)
megengine.functional.concat
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.transpose(x_tmp, (0, 2, 3, 1))
megengine.functional.transpose
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.transpose(x_tmp, (0, 2, 3, 1))
megengine.functional.transpose
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
amp.autocast(enabled=self.mixed_precision)
megengine.amp.autocast
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.reshape(x, (x.shape[0], image1.shape[2] // 16, -1, x.shape[2]))
megengine.functional.reshape
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
amp.autocast(enabled=self.mixed_precision)
megengine.amp.autocast
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
amp.autocast(enabled=self.mixed_precision)
megengine.amp.autocast
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.sigmoid(offset_dw8)
megengine.functional.sigmoid
import megengine.module as M import megengine.functional as F from megengine import amp from .update import BasicUpdateBlock from .extractor import BasicEncoder from .corr import AGCL from .attention import PositionEncodingSine, LocalFeatureTransformer class CREStereo(M.Module): def __init__(self, max_disp=192,...
F.sigmoid(offset_dw16)
megengine.functional.sigmoid
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ...
mge.load(traced_module)
megengine.load
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.BatchNorm2d(self.in_channels)
megengine.module.BatchNorm2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.BatchNorm2d(self.hidden_channels)
megengine.module.BatchNorm2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.ReLU()
megengine.module.ReLU
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.ReLU()
megengine.module.ReLU
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.Conv2d(self.in_channels, self.out_channels, 3, 1, 1)
megengine.module.Conv2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.Conv2d(self.out_channels, self.out_channels, 3, 1, 1)
megengine.module.Conv2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.Conv2d(self.in_channels, self.out_channels, 1, 1, 0)
megengine.module.Conv2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.ReLU()
megengine.module.ReLU
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.init.xavier_uniform_(self.c_sc.weight, 1.0)
megengine.module.init.xavier_uniform_
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.avg_pool2d(h, 2)
megengine.functional.avg_pool2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.init.xavier_uniform_(self.c_sc.weight, 1.0)
megengine.module.init.xavier_uniform_
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.Conv2d(in_channels, out_channels, 1, 1, 0)
megengine.module.Conv2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
M.init.xavier_uniform_(self.c_sc.weight, 1.0)
megengine.module.init.xavier_uniform_
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.avg_pool2d(h, 2)
megengine.functional.avg_pool2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.avg_pool2d(x, 2)
megengine.functional.avg_pool2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.avg_pool2d(x, 2)
megengine.functional.avg_pool2d
# Copyright (c) 2020 <NAME> # This code is licensed under MIT license # (https://github.com/kwotsin/mimicry/blob/master/LICENSE) # ------------------------------------------------------------------------------ # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2021 Megv...
F.relu(x)
megengine.functional.relu
#!/usr/bin/env python # -*-coding=utf-8-*- from megengine.logger import get_logger logger =
get_logger(__name__)
megengine.logger.get_logger
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.is_distributed()
megengine.distributed.is_distributed
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.is_distributed()
megengine.distributed.is_distributed
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.all_reduce_sum(loss)
megengine.distributed.all_reduce_sum
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.all_reduce_sum(acc1)
megengine.distributed.all_reduce_sum
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.all_reduce_sum(acc5)
megengine.distributed.all_reduce_sum
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.all_reduce_sum(loss)
megengine.distributed.all_reduce_sum
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.all_reduce_sum(acc1)
megengine.distributed.all_reduce_sum
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.all_reduce_sum(acc5)
megengine.distributed.all_reduce_sum
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_world_size()
megengine.distributed.get_world_size
# -*- coding: utf-8 -*- # MIT License # # Copyright (c) 2019 Megvii Technology # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights #...
dist.get_rank()
megengine.distributed.get_rank
# MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTIES OR CONDITIONS OF ANY ...
mge.load(traced_module)
megengine.load
import numpy as np from megengine import tensor def _default_compare_fn(x, y): np.testing.assert_allclose(x.numpy(), y, rtol=1e-6) def opr_test(cases, func, compare_fn=_default_compare_fn, ref_fn=None, **kwargs): """ :param cases: the list which have dict element, the list length should be 2 for dynami...
tensor(inpi)
megengine.tensor
from itertools import product import numpy as np from megengine import tensor from megengine.module import ( Conv2d, ConvBn2d, ConvRelu2d, DequantStub, Module, QuantStub, ) from megengine.quantization.quantize import disable_fake_quant, quantize_qat def test_qat_convbn2d(): in_channels =...
quantize_qat(module, inplace=False)
megengine.quantization.quantize.quantize_qat
from itertools import product import numpy as np from megengine import tensor from megengine.module import ( Conv2d, ConvBn2d, ConvRelu2d, DequantStub, Module, QuantStub, ) from megengine.quantization.quantize import disable_fake_quant, quantize_qat def test_qat_convbn2d(): in_channels =...
disable_fake_quant(qat_module)
megengine.quantization.quantize.disable_fake_quant
from itertools import product import numpy as np from megengine import tensor from megengine.module import ( Conv2d, ConvBn2d, ConvRelu2d, DequantStub, Module, QuantStub, ) from megengine.quantization.quantize import disable_fake_quant, quantize_qat def test_qat_convbn2d(): in_channels =...
quantize_qat(net, inplace=False)
megengine.quantization.quantize.quantize_qat
from itertools import product import numpy as np from megengine import tensor from megengine.module import ( Conv2d, ConvBn2d, ConvRelu2d, DequantStub, Module, QuantStub, ) from megengine.quantization.quantize import disable_fake_quant, quantize_qat def test_qat_convbn2d(): in_channels =...
disable_fake_quant(qat_net)
megengine.quantization.quantize.disable_fake_quant
from itertools import product import numpy as np from megengine import tensor from megengine.module import ( Conv2d, ConvBn2d, ConvRelu2d, DequantStub, Module, QuantStub, ) from megengine.quantization.quantize import disable_fake_quant, quantize_qat def test_qat_convbn2d(): in_channels =...
QuantStub()
megengine.module.QuantStub
from itertools import product import numpy as np from megengine import tensor from megengine.module import ( Conv2d, ConvBn2d, ConvRelu2d, DequantStub, Module, QuantStub, ) from megengine.quantization.quantize import disable_fake_quant, quantize_qat def test_qat_convbn2d(): in_channels =...
DequantStub()
megengine.module.DequantStub
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
tensor(lr)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
tensor(weight_decay)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
tensor(momentum)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
tensor(-lr)
megengine.tensor
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
F.sum(vec * vec)
megengine.functional.sum
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
_inplace_add_(param, grad, alpha=c1, beta=_neg_lr * trust_ratio)
megengine.functional.inplace._inplace_add_
#!/usr/bin/env python3 # Copyright (c) 2020 <NAME> # This file has been modified by Megvii ("Megvii Modifications"). # All Megvii Modifications are Copyright (c) 2014-2021 Megvii Inc. All rights reserved. """LARS optimizer References: https://github.com/rwightman/pytorch-image-models/blob/master/timm/optim/lars.py """...
_inplace_add_(v, grad, alpha=_momentum, beta=c1)
megengine.functional.inplace._inplace_add_
import os import megengine as mge import megengine.functional as F import argparse import numpy as np import cv2 from nets import Model def load_model(model_path): print("Loading model:", os.path.abspath(model_path)) pretrained_dict =
mge.load(model_path)
megengine.load
import os import megengine as mge import megengine.functional as F import argparse import numpy as np import cv2 from nets import Model def load_model(model_path): print("Loading model:", os.path.abspath(model_path)) pretrained_dict = mge.load(model_path) model = Model(max_disp=256, mixed_precision=Fals...
mge.tensor(imgL)
megengine.tensor
import os import megengine as mge import megengine.functional as F import argparse import numpy as np import cv2 from nets import Model def load_model(model_path): print("Loading model:", os.path.abspath(model_path)) pretrained_dict = mge.load(model_path) model = Model(max_disp=256, mixed_precision=Fals...
mge.tensor(imgR)
megengine.tensor
import os import megengine as mge import megengine.functional as F import argparse import numpy as np import cv2 from nets import Model def load_model(model_path): print("Loading model:", os.path.abspath(model_path)) pretrained_dict = mge.load(model_path) model = Model(max_disp=256, mixed_precision=Fals...
F.squeeze(pred_flow[:, 0, :, :])
megengine.functional.squeeze
import os import cv2 import argparse import warnings import megengine as mge import megengine.functional as F warnings.filterwarnings("ignore") parser = argparse.ArgumentParser(description='Interpolation for a pair of images') parser.add_argument('--img', dest='img', nargs=2, required=True) parser.add_argument('--exp'...
F.nn.pad(img0, padding)
megengine.functional.nn.pad
import os import cv2 import argparse import warnings import megengine as mge import megengine.functional as F warnings.filterwarnings("ignore") parser = argparse.ArgumentParser(description='Interpolation for a pair of images') parser.add_argument('--img', dest='img', nargs=2, required=True) parser.add_argument('--exp'...
F.nn.pad(img1, padding)
megengine.functional.nn.pad
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
hub.pretrained( "https://data.megengine.org.cn/models/weights/mspn_4stage_256x192_0_255_75_2.pkl" )
megengine.hub.pretrained
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
M.Sequential(*layers)
megengine.module.Sequential
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
M.Conv2d(channel, mid_channel, 1, 1, 0)
megengine.module.Conv2d
# -*- coding: utf-8 -*- # MegEngine is Licensed under the Apache License, Version 2.0 (the "License") # # Copyright (c) 2014-2020 Megvii Inc. All rights reserved. # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT ARRANTI...
M.ConvTranspose2d(mid_channel, mid_channel, 4, 2, 1)
megengine.module.ConvTranspose2d