导入数学和TypeError:“ builtin_function_or_method”对象不可下标

时间:2020-05-07 18:33:05

标签: python math

if (controlsRef !== undefined && controlsRef.current !== undefined) {
    controlsRef!.current!.target = ...
    // Errors with target does not exist on type 'never'
}
useFrame(() => controlsRef.current && controlsRef?.current?.update());
// Errors with update does not exist on type 'never'

1 个答案:

答案 0 :(得分:2)

调用m.cos时需要使用括号。 您的方法调用应如下所示:

    Traceback (most recent call last):
  File "/home/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/training.py", line 2659, in _set_inputs
    outputs = self(inputs, **kwargs)
  File "/home/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 773, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
  File "/home/.local/lib/python3.7/site-packages/tensorflow_core/python/autograph/impl/api.py", line 237, in wrapper
    raise e.ag_error_metadata.to_exception(e)
TypeError: in converted code:

    /home/lemmatizer_noattn.py:155 call  *
        output_layer, _, output_lens, _ = self.DecoderTraining((source_states, target_charseqs), True)
    /home/.local/lib/python3.7/site-packages/tensorflow_core/python/keras/engine/base_layer.py:785 __call__
        str(e) + '\n"""')

    TypeError: You are attempting to use Python control flow in a layer that was not declared to be dynamic. Pass `dynamic=True` to the class constructor.
    Encountered error:
    """
    in converted code:

        /home/.local/lib/python3.7/site-packages/tensorflow_addons/seq2seq/decoder.py:162 call  *
            return dynamic_decode(
        /home/.local/lib/python3.7/site-packages/tensorflow_addons/seq2seq/decoder.py:405 body  *
            (next_outputs, decoder_state, next_inputs, decoder_finished) = decoder.step(
        /home/.local/lib/python3.7/site-packages/tensorflow_core/python/ops/control_flow_ops.py:2478 while_loop_v2
            return_same_structure=True)
        /home/lemmatizer_noattn.py:79 step  *
            outputs, [states] = self.lemmatizer.target_rnn_cell(inputs, [states])
        /home/.local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py:539 __iter__
            self._disallow_iteration()
        /home/.local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py:535 _disallow_iteration
            self._disallow_in_graph_mode("iterating over `tf.Tensor`")
        /home/.local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py:515 _disallow_in_graph_mode
            " this function with @tf.function.".format(task))

        OperatorNotAllowedInGraphError: iterating over `tf.Tensor` is not allowed in Graph execution. Use Eager execution or decorate this function with @tf.function.

    """