You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

exp_basic.py 1.1 kB

12345678910111213141516171819202122232425262728293031323334353637
  1. import mindspore
  2. import mindspore.nn as nn
  3. from mindspore import context
  4. class Exp_Basic(nn.Cell):
  5. def __init__(self, args):
  6. super(Exp_Basic, self).__init__()
  7. self.args = args
  8. self.device = self._acquire_device()
  9. self.model = self._build_model().to(self.device)
  10. def _build_model(self):
  11. raise NotImplementedError
  12. return None
  13. def _acquire_device(self):
  14. if self.args.use_gpu:
  15. context.set_context(mode=context.GRAPH_MODE, device_target="GPU", device_id=str(self.args.gpu) if not self.args.use_multi_gpu else self.args.devices)
  16. device = mindspore.cuda_device('cuda:{}'.format(self.args.gpu))
  17. print('Use GPU: cuda:{}'.format(self.args.gpu))
  18. else:
  19. context.set_context(mode=context.GRAPH_MODE, device_target="CPU")
  20. device = mindspore.cpu_device()
  21. print('Use CPU')
  22. return device
  23. def _get_data(self):
  24. pass
  25. def vali(self):
  26. pass
  27. def train(self):
  28. pass
  29. def test(self):
  30. pass

基于MindSpore的多模态股票价格预测系统研究 Informer,LSTM,RNN