You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi, i had this error , and i have no idea how to deal with it , tensorflow=2.16.1, python=3.9.13
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_15400\3913273976.py in
1 model = dde.Model(data, net)
2 model.compile("adam", lr=1e-3)
----> 3 model.train(iterations=4000)
E:\Anaconda3\lib\site-packages\deepxde\utils\internal.py in wrapper(*args, **kwargs)
20 def wrapper(*args, **kwargs):
21 ts = timeit.default_timer()
---> 22 result = f(*args, **kwargs)
23 te = timeit.default_timer()
24 if config.rank == 0:
E:\Anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *args, **kwargs)
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1528
1529 try:
E:\Anaconda3\lib\site-packages\deepxde\nn\pytorch\fnn.py in forward(self, inputs)
45 x = self.linears-1
46 if self._output_transform is not None:
---> 47 x = self._output_transform(inputs, x)
48 return x
49
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
hi, i had this error , and i have no idea how to deal with it , tensorflow=2.16.1, python=3.9.13
AttributeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_15400\3913273976.py in
1 model = dde.Model(data, net)
2 model.compile("adam", lr=1e-3)
----> 3 model.train(iterations=4000)
E:\Anaconda3\lib\site-packages\deepxde\utils\internal.py in wrapper(*args, **kwargs)
20 def wrapper(*args, **kwargs):
21 ts = timeit.default_timer()
---> 22 result = f(*args, **kwargs)
23 te = timeit.default_timer()
24 if config.rank == 0:
E:\Anaconda3\lib\site-packages\deepxde\model.py in train(self, iterations, batch_size, display_every, disregard_previous_best, callbacks, model_restore_path, model_save_path, epochs)
634 self.train_state.set_data_train(*self.data.train_next_batch(self.batch_size))
635 self.train_state.set_data_test(*self.data.test())
--> 636 self._test()
637 self.callbacks.on_train_begin()
638 if optimizers.is_external_optimizer(self.opt_name):
E:\Anaconda3\lib\site-packages\deepxde\model.py in _test(self)
823 self.train_state.y_pred_train,
824 self.train_state.loss_train,
--> 825 ) = self._outputs_losses(
826 True,
827 self.train_state.X_train,
E:\Anaconda3\lib\site-packages\deepxde\model.py in outputs_losses(self, training, inputs, targets, auxiliary_vars)
544 elif backend_name == "pytorch":
545 self.net.requires_grad(requires_grad=False)
--> 546 outs = outputs_losses(inputs, targets, auxiliary_vars)
547 self.net.requires_grad_()
548 elif backend_name == "jax":
E:\Anaconda3\lib\site-packages\deepxde\model.py in outputs_losses_train(inputs, targets, auxiliary_vars)
318
319 def outputs_losses_train(inputs, targets, auxiliary_vars):
--> 320 return outputs_losses(
321 True, inputs, targets, auxiliary_vars, self.data.losses_train
322 )
E:\Anaconda3\lib\site-packages\deepxde\model.py in outputs_losses(training, inputs, targets, auxiliary_vars, losses_fn)
300 inputs = torch.as_tensor(inputs)
301 inputs.requires_grad_()
--> 302 outputs_ = self.net(inputs)
303 # Data losses
304 if targets is not None:
E:\Anaconda3\lib\site-packages\torch\nn\modules\module.py in _wrapped_call_impl(self, *args, **kwargs)
1516 return self._compiled_call_impl(*args, **kwargs) # type: ignore[misc]
1517 else:
-> 1518 return self._call_impl(*args, **kwargs)
1519
1520 def _call_impl(self, *args, **kwargs):
E:\Anaconda3\lib\site-packages\torch\nn\modules\module.py in _call_impl(self, *args, **kwargs)
1525 or _global_backward_pre_hooks or _global_backward_hooks
1526 or _global_forward_hooks or _global_forward_pre_hooks):
-> 1527 return forward_call(*args, **kwargs)
1528
1529 try:
E:\Anaconda3\lib\site-packages\deepxde\nn\pytorch\fnn.py in forward(self, inputs)
45 x = self.linears-1
46 if self._output_transform is not None:
---> 47 x = self._output_transform(inputs, x)
48 return x
49
~\AppData\Local\Temp\ipykernel_15400\3308803486.py in output_transform(x, y)
1 def output_transform(x, y):
----> 2 return x[:, 0:1]**2 * tf.cos(np.pi * x[:, 0:1]) + x[:, 1:2] * (1 - x[:, 0:1]**2) * y
3
4 net.apply_output_transform(output_transform)
AttributeError: 'function' object has no attribute 'cos'
Beta Was this translation helpful? Give feedback.
All reactions