def __init__(self): super(SendNet, self).__init__() self.x = Parameter(initializer(Tensor(x), x.shape), name='x') self.depend = P.Depend() self.send = Send(sr_tag=0, dest_rank=rank + size // 2, group=NCCL_WORLD_COMM_GROUP)
def __init__(self): super().__init__() self.parameter1 = Parameter(Tensor([199.0], ms.float32), name="parameter1") self.assign = P.Assign() self.assignadd = P.AssignAdd() self.addn = P.AddN() self.depend = P.Depend()
def __init__(self, var, accum): super().__init__() self.depend = P.Depend() self.sparse_apply_proximal_adagrad = P.SparseApplyProximalAdagrad() self.var = Parameter(var, name="var") self.accum = Parameter(accum, name="accum") self.const = Tensor(9999, mstype.float32)
def test_elim_depend_value(tag): """ test_elim_depend_value """ fns = FnDict() depend = P.Depend() @fns def before(x): return depend(x, None) @fns def after(x): return x return fns[tag]
def __init__(self): super(Net2, self).__init__() self.relu1 = P.ReLU() self.relu2 = P.ReLU().add_prim_attr("primitive_target", "CPU") self.mul = P.Mul() self.depend = P.Depend()
def __init__(self): super(Net1, self).__init__() self.relu1 = P.ReLU() self.relu2 = P.ReLU() self.mul = P.Mul() self.depend = P.Depend()
# You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================ from mindspore.ops import Primitive from mindspore.ops import operations as P from mindspore.ops import _constants as Constants depend = P.Depend() all_reduce = P.AllReduce() broadcast = P.Broadcast(1) tensor_move = Primitive('TensorMove') make_tuple = Primitive('MakeTuple') tuple_getitem = Primitive(Constants.kTupleGetItem) assign_add = P.AssignAdd() apply_momentun = P.ApplyMomentum() relu = P.ReLU() class FnDict: def __init__(self): self.fnDict = {} def __call__(self, fn):