ошибочка
def call(self, inputs):
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
в этих строках кода пишет что нужно передать числовое значение, что не так? return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :] ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TypeError: Exception encountered when calling PositionalEncoding.call().
Такая же фигня: Exception has occurred: TypeError Exception encountered when calling PositionalEncoding.call().
[1mCould not automatically infer the output shape / dtype of 'positional_encoding' (of type PositionalEncoding). Either the PositionalEncoding.call() method is incorrect, or you need to implement the PositionalEncoding.compute_output_spec() / compute_output_shape() method. Error encountered:
Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.[0m
Arguments received by PositionalEncoding.call(): • args=('<KerasTensor shape=(None, None, 512), dtype=float32, sparse=True, name=keras_tensor_4>',) • kwargs=<class 'inspect._empty'> ValueError: SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64))
During handling of the above exception, another exception occurred:
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 121, in call return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :] ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TypeError: Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.
During handling of the above exception, another exception occurred:
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 121, in call
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
TypeError: Could not automatica
lly infer the output shape / dtype of 'positional_encoding' (of type PositionalEncoding). Either the
PositionalEncoding.call() method is incorrect, or you need to implement the PositionalEncoding.compute_output_spec() / compute_output_shape() method. Error encountered:
Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.
During handling of the above exception, another exception occurred:
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 121, in call
return inputs + self.pos_encoding[:, : tf.shape(inputs)[1], :]
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 150, in encoder
embeddings = PositionalEncoding(vocab_size, d_model)(embeddings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Admin\Documents\DolboNet\core\tf_transformer.py", line 256, in transformer
enc_outputs = encoder(
^^^^^^^^
File "C:\Users\Admin\Documents\DolboNet\core\predictor.py", line 24, in
[1mCould not automatically infer the output shape / dtype of 'positional_encoding' (of type PositionalEncoding). Either the PositionalEncoding.call() method is incorrect, or you need to implement the PositionalEncoding.compute_output_spec() / compute_output_shape() method. Error encountered:
Expected float32, but got SparseTensor(indices=Tensor("Placeholder_1:0", shape=(None, 3), dtype=int64), values=Tensor("Placeholder:0", shape=(None,), dtype=float32), dense_shape=Tensor("PlaceholderWithDefault:0", shape=(3,), dtype=int64)) of type 'SparseTensor'.[0m
Arguments received by PositionalEncoding.call(): • args=('<KerasTensor shape=(None, None, 512), dtype=float32, sparse=True, name=keras_tensor_4>',) • kwargs=<class 'inspect._empty'>