主頁 > 企業開發 > 為什么擬合我的tensorflow模型會回傳值錯誤?

為什么擬合我的tensorflow模型會回傳值錯誤?

2022-11-16 05:46:27 企業開發

我正在跟隨一個教程,并且正在使用 tensorflow 構建一個簡單的回歸模型。我希望 tf 能夠順利地擬合模型。相反,我收到一個值錯誤。

模型和編譯步驟看起來與教程相同。

資料相似(兩個 numpy 陣列)。我在陣列中使用了不同的數字,但我認為這不是問題所在。任何兩個長度相等的陣列都應該有效,對吧?

X = tf.constant(np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
y = tf.constant(np.array([1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31]))

model = tf.keras.Sequential([
    tf.keras.layers.Dense(1)
])

model.compile(
    loss=tf.keras.losses.mae,
    optimizer=tf.keras.optimizers.SGD(),
    metrics=["mae"]
)

model.fit(X, y, epochs=10)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-41-2da4b2bd3c5c> in <module>
     12 )
     13 
---> 14 model.fit(X, y, epochs=10)

~/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
     59     def error_handler(*args, **kwargs):
     60         if not tf.debugging.is_traceback_filtering_enabled():
---> 61             return fn(*args, **kwargs)
     62 
     63         filtered_tb = None

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py in fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_batch_size, validation_freq, max_queue_size, workers, use_multiprocessing)
   1562                         ):
   1563                             callbacks.on_train_batch_begin(step)
-> 1564                             tmp_logs = self.train_function(iterator)
   1565                             if data_handler.should_sync:
   1566                                 context.async_wait()

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/util/traceback_utils.py in error_handler(*args, **kwargs)
    139     try:
    140       if not is_traceback_filtering_enabled():
--> 141         return fn(*args, **kwargs)
    142     except NameError:
    143       # In some very rare cases,

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in __call__(self, *args, **kwds)
    913 
    914       with OptionalXlaContext(self._jit_compile):
--> 915         result = self._call(*args, **kwds)
    916 
    917       new_tracing_count = self.experimental_get_tracing_count()

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in _call(self, *args, **kwds)
    961       # This is the first call of __call__, so we have to initialize.
    962       initializers = []
--> 963       self._initialize(args, kwds, add_initializers_to=initializers)
    964     finally:
    965       # At this point we know that the initialization is complete (or less

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in _initialize(self, args, kwds, add_initializers_to)
    783     self._graph_deleter = FunctionDeleter(self._lifted_initializer_graph)
    784     self._concrete_stateful_fn = (
--> 785         self._stateful_fn._get_concrete_function_internal_garbage_collected(  # pylint: disable=protected-access
    786             *args, **kwds))
    787 

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/function.py in _get_concrete_function_internal_garbage_collected(self, *args, **kwargs)
   2521       args, kwargs = None, None
   2522     with self._lock:
-> 2523       graph_function, _ = self._maybe_define_function(args, kwargs)
   2524     return graph_function
   2525 

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/function.py in _maybe_define_function(self, args, kwargs)
   2758             # Only get placeholders for arguments, not captures
   2759             args, kwargs = placeholder_dict["args"]
-> 2760           graph_function = self._create_graph_function(args, kwargs)
   2761 
   2762           graph_capture_container = graph_function.graph._capture_func_lib  # pylint: disable=protected-access

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/function.py in _create_graph_function(self, args, kwargs)
   2668     arg_names = base_arg_names   missing_arg_names
   2669     graph_function = ConcreteFunction(
-> 2670         func_graph_module.func_graph_from_py_func(
   2671             self._name,
   2672             self._python_function,

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py in func_graph_from_py_func(name, python_func, args, kwargs, signature, func_graph, autograph, autograph_options, add_control_dependencies, arg_names, op_return_value, collections, capture_by_value, acd_record_initial_resource_uses)
   1245         _, original_func = tf_decorator.unwrap(python_func)
   1246 
-> 1247       func_outputs = python_func(*func_args, **func_kwargs)
   1248 
   1249       # invariant: `func_outputs` contains only Tensors, CompositeTensors,

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/eager/def_function.py in wrapped_fn(*args, **kwds)
    675         # the function a weak reference to itself to avoid a reference cycle.
    676         with OptionalXlaContext(compile_with_xla):
--> 677           out = weak_wrapped_fn().__wrapped__(*args, **kwds)
    678         return out
    679 

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
   1231           except Exception as e:  # pylint:disable=broad-except
   1232             if hasattr(e, "ag_error_metadata"):
-> 1233               raise e.ag_error_metadata.to_exception(e)
   1234             else:
   1235               raise

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/framework/func_graph.py in autograph_handler(*args, **kwargs)
   1220           # TODO(mdan): Push this block higher in tf.function's call stack.
   1221           try:
-> 1222             return autograph.converted_call(
   1223                 original_func,
   1224                 args,

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
    437     try:
    438       if kwargs is not None:
--> 439         result = converted_f(*effective_args, **kwargs)
    440       else:
    441         result = converted_f(*effective_args)

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py in tf__train_function(iterator)
     13                 try:
     14                     do_return = True
---> 15                     retval_ = ag__.converted_call(ag__.ld(step_function), (ag__.ld(self), ag__.ld(iterator)), None, fscope)
     16                 except:
     17                     do_return = False

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
    375 
    376   if not options.user_requested and conversion.is_allowlisted(f):
--> 377     return _call_unconverted(f, args, kwargs, options)
    378 
    379   # internal_convert_user_code is for example turned off when issuing a dynamic

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py in _call_unconverted(f, args, kwargs, options, update_cache)
    457   if kwargs is not None:
    458     return f(*args, **kwargs)
--> 459   return f(*args)
    460 
    461 

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py in step_function(model, iterator)
   1144                 )
   1145             data = next(iterator)
-> 1146             outputs = model.distribute_strategy.run(run_step, args=(data,))
   1147             outputs = reduce_per_replica(
   1148                 outputs, self.distribute_strategy, reduction="first"

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py in run(***failed resolving arguments***)
   1313       fn = autograph.tf_convert(
   1314           fn, autograph_ctx.control_status_ctx(), convert_by_default=False)
-> 1315       return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
   1316 
   1317   def reduce(self, reduce_op, value, axis):

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py in call_for_each_replica(self, fn, args, kwargs)
   2889       kwargs = {}
   2890     with self._container_strategy().scope():
-> 2891       return self._call_for_each_replica(fn, args, kwargs)
   2892 
   2893   def _call_for_each_replica(self, fn, args, kwargs):

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py in _call_for_each_replica(self, fn, args, kwargs)
   3690   def _call_for_each_replica(self, fn, args, kwargs):
   3691     with ReplicaContext(self._container_strategy(), replica_id_in_sync_group=0):
-> 3692       return fn(*args, **kwargs)
   3693 
   3694   def _reduce_to(self, reduce_op, value, destinations, options):

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py in wrapper(*args, **kwargs)
    687       try:
    688         with conversion_ctx:
--> 689           return converted_call(f, args, kwargs, options=options)
    690       except Exception as e:  # pylint:disable=broad-except
    691         if hasattr(e, 'ag_error_metadata'):

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py in converted_call(f, args, kwargs, caller_fn_scope, options)
    375 
    376   if not options.user_requested and conversion.is_allowlisted(f):
--> 377     return _call_unconverted(f, args, kwargs, options)
    378 
    379   # internal_convert_user_code is for example turned off when issuing a dynamic

~/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/autograph/impl/api.py in _call_unconverted(f, args, kwargs, options, update_cache)
    456 
    457   if kwargs is not None:
--> 458     return f(*args, **kwargs)
    459   return f(*args)
    460 

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py in run_step(data)
   1133 
   1134             def run_step(data):
-> 1135                 outputs = model.train_step(data)
   1136                 # Ensure counter is updated only if `train_step` succeeds.
   1137                 with tf.control_dependencies(_minimum_control_deps(outputs)):

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py in train_step(self, data)
    991         # Run forward pass.
    992         with tf.GradientTape() as tape:
--> 993             y_pred = self(x, training=True)
    994             loss = self.compute_loss(x, y, y_pred, sample_weight)
    995         self._validate_target_and_loss(y, loss)

~/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
     59     def error_handler(*args, **kwargs):
     60         if not tf.debugging.is_traceback_filtering_enabled():
---> 61             return fn(*args, **kwargs)
     62 
     63         filtered_tb = None

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py in __call__(self, *args, **kwargs)
    555             layout_map_lib._map_subclass_model_variable(self, self._layout_map)
    556 
--> 557         return super().__call__(*args, **kwargs)
    558 
    559     @doc_controls.doc_in_current_and_subclasses

~/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
     59     def error_handler(*args, **kwargs):
     60         if not tf.debugging.is_traceback_filtering_enabled():
---> 61             return fn(*args, **kwargs)
     62 
     63         filtered_tb = None

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
   1095                     self._compute_dtype_object
   1096                 ):
-> 1097                     outputs = call_fn(inputs, *args, **kwargs)
   1098 
   1099                 if self._activity_regularizer:

~/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
    153             else:
    154                 new_e = e
--> 155             raise new_e.with_traceback(e.__traceback__) from None
    156         finally:
    157             del signature

~/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
     94         bound_signature = None
     95         try:
---> 96             return fn(*args, **kwargs)
     97         except Exception as e:
     98             if hasattr(e, "_keras_call_info_injected"):

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/sequential.py in call(self, inputs, training, mask)
    423                 kwargs["training"] = training
    424 
--> 425             outputs = layer(inputs, **kwargs)
    426 
    427             if len(tf.nest.flatten(outputs)) != 1:

~/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
     59     def error_handler(*args, **kwargs):
     60         if not tf.debugging.is_traceback_filtering_enabled():
---> 61             return fn(*args, **kwargs)
     62 
     63         filtered_tb = None

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/base_layer.py in __call__(self, *args, **kwargs)
   1063         ):
   1064 
-> 1065             input_spec.assert_input_compatibility(
   1066                 self.input_spec, inputs, self.name
   1067             )

~/opt/anaconda3/lib/python3.8/site-packages/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
    248             ndim = x.shape.rank
    249             if ndim is not None and ndim < spec.min_ndim:
--> 250                 raise ValueError(
    251                     f'Input {input_index} of layer "{layer_name}" '
    252                     "is incompatible with the layer: "

ValueError: in user code:

    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py", line 1160, in train_function  *
        return step_function(self, iterator)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py", line 1146, in step_function  **
        outputs = model.distribute_strategy.run(run_step, args=(data,))
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py", line 1315, in run
        return self._extended.call_for_each_replica(fn, args=args, kwargs=kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py", line 2891, in call_for_each_replica
        return self._call_for_each_replica(fn, args, kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/tensorflow/python/distribute/distribute_lib.py", line 3692, in _call_for_each_replica
        return fn(*args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py", line 1135, in run_step  **
        outputs = model.train_step(data)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py", line 993, in train_step
        y_pred = self(x, training=True)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 61, in error_handler
        return fn(*args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/training.py", line 557, in __call__
        return super().__call__(*args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 61, in error_handler
        return fn(*args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1097, in __call__
        outputs = call_fn(inputs, *args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 155, in error_handler
        raise new_e.with_traceback(e.__traceback__) from None
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 96, in error_handler
        return fn(*args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/sequential.py", line 425, in call
        outputs = layer(inputs, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/utils/traceback_utils.py", line 61, in error_handler
        return fn(*args, **kwargs)
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/base_layer.py", line 1065, in __call__
        input_spec.assert_input_compatibility(
    File "/Users/mcm66103/opt/anaconda3/lib/python3.8/site-packages/keras/engine/input_spec.py", line 250, in assert_input_compatibility
        raise ValueError(

    ValueError: Exception encountered when calling layer "sequential_24" "                 f"(type Sequential).
    
    Input 0 of layer "dense_25" is incompatible with the layer: expected min_ndim=2, found ndim=1. Full shape received: (None,)
    
    Call arguments received by layer "sequential_24" "                 f"(type Sequential):
      ? inputs=tf.Tensor(shape=(None,), dtype=int64)
      ? training=True
      ? mask=None

uj5u.com熱心網友回復:

您缺少圖層所需的特征維度Dense,因為您的模型正在根據您提供的資料推斷輸入形狀,因此請嘗試:

import tensorflow as tf
import numpy as np

X = tf.constant(np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))[:, None]
y = tf.constant(np.array([1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31]))

model = tf.keras.Sequential([
    tf.keras.layers.Dense(1)
])

model.compile(
    loss=tf.keras.losses.mae,
    optimizer=tf.keras.optimizers.SGD(),
    metrics=["mae"]
)

model.fit(X, y, epochs=10)

您也可以使用X = tf.expand_dims(X, axis=-1).

uj5u.com熱心網友回復:

嘗試在 Sequential 模型中添加一個輸入層:

X = tf.constant(np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
y = tf.constant(np.array([1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31]))

model = tf.keras.Sequential([
    tf.keras.layers.InputLayer(input_shape=(1,)), # This will take care of dimensions
    tf.keras.layers.Dense(1)
])

model.compile(
    loss=tf.keras.losses.mae,
    optimizer=tf.keras.optimizers.SGD(),
    metrics=["mae"]
)

model.fit(X, y, epochs=10)

有關參考,請參閱:tf.keras.InputLayer

uj5u.com熱心網友回復:

你應該試試這個代碼......

X = tf.constant(np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]))
y = tf.constant(np.array([1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31]))

model = tf.keras.Sequential([
    tf.keras.layers.Dense(1)
])

model.compile(
    loss=tf.keras.losses.mae,
    optimizer=tf.keras.optimizers.SGD(),
    metrics=["mae"]
)
X = tf.expand_dims(X , axis=0)
y = tf.expand_dims(y , axis=0)
model.fit(X, y, epochs=10)

輸出

Epoch 1/10
1/1 [==============================] - 1s 777ms/step - loss: 14.0288 - mae: 14.0288
Epoch 2/10
1/1 [==============================] - 0s 8ms/step - loss: 11.6894 - mae: 11.6894
Epoch 3/10
1/1 [==============================] - 0s 9ms/step - loss: 10.2720 - mae: 10.2720
Epoch 4/10
1/1 [==============================] - 0s 9ms/step - loss: 9.4745 - mae: 9.4745
Epoch 5/10
1/1 [==============================] - 0s 9ms/step - loss: 8.9153 - mae: 8.9153
Epoch 6/10
1/1 [==============================] - 0s 10ms/step - loss: 8.6282 - mae: 8.6282
Epoch 7/10
1/1 [==============================] - 0s 9ms/step - loss: 8.4167 - mae: 8.4167
Epoch 8/10
1/1 [==============================] - 0s 5ms/step - loss: 8.3848 - mae: 8.3848
Epoch 9/10
1/1 [==============================] - 0s 9ms/step - loss: 8.3529 - mae: 8.3529
Epoch 10/10
1/1 [==============================] - 0s 10ms/step - loss: 8.3210 - mae: 8.3210

轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/534011.html

標籤:Python张量流喀拉斯

上一篇:了解堆疊的LSTM層

下一篇:如何解決“IndexError:元組索引超出范圍”?

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • IEEE1588PTP在數字化變電站時鐘同步方面的應用

    IEEE1588ptp在數字化變電站時鐘同步方面的應用 京準電子科技官微——ahjzsz 一、電力系統時間同步基本概況 隨著對IEC 61850標準研究的不斷深入,國內外學者提出基于IEC61850通信標準體系建設數字化變電站的發展思路。數字化變電站與常規變電站的顯著區別在于程序層傳統的電流/電壓互 ......

    uj5u.com 2020-09-10 03:51:52 more
  • HTTP request smuggling CL.TE

    CL.TE 簡介 前端通過Content-Length處理請求,通過反向代理或者負載均衡將請求轉發到后端,后端Transfer-Encoding優先級較高,以TE處理請求造成安全問題。 檢測 發送如下資料包 POST / HTTP/1.1 Host: ac391f7e1e9af821806e890 ......

    uj5u.com 2020-09-10 03:52:11 more
  • 網路滲透資料大全單——漏洞庫篇

    網路滲透資料大全單——漏洞庫篇漏洞庫 NVD ——美國國家漏洞庫 →http://nvd.nist.gov/。 CERT ——美國國家應急回應中心 →https://www.us-cert.gov/ OSVDB ——開源漏洞庫 →http://osvdb.org Bugtraq ——賽門鐵克 →ht ......

    uj5u.com 2020-09-10 03:52:15 more
  • 京準講述NTP時鐘服務器應用及原理

    京準講述NTP時鐘服務器應用及原理京準講述NTP時鐘服務器應用及原理 安徽京準電子科技官微——ahjzsz 北斗授時原理 授時是指接識訓通過某種方式獲得本地時間與北斗標準時間的鐘差,然后調整本地時鐘使時差控制在一定的精度范圍內。 衛星導航系統通常由三部分組成:導航授時衛星、地面檢測校正維護系統和用戶 ......

    uj5u.com 2020-09-10 03:52:25 more
  • 利用北斗衛星系統設計NTP網路時間服務器

    利用北斗衛星系統設計NTP網路時間服務器 利用北斗衛星系統設計NTP網路時間服務器 安徽京準電子科技官微——ahjzsz 概述 NTP網路時間服務器是一款支持NTP和SNTP網路時間同步協議,高精度、大容量、高品質的高科技時鐘產品。 NTP網路時間服務器設備采用冗余架構設計,高精度時鐘直接來源于北斗 ......

    uj5u.com 2020-09-10 03:52:35 more
  • 詳細解讀電力系統各種對時方式

    詳細解讀電力系統各種對時方式 詳細解讀電力系統各種對時方式 安徽京準電子科技官微——ahjzsz,更多資料請添加VX 衛星同步時鐘是我京準公司開發研制的應用衛星授時時技術的標準時間顯示和發送的裝置,該裝置以M國全球定位系統(GLOBAL POSITIONING SYSTEM,縮寫為GPS)或者我國北 ......

    uj5u.com 2020-09-10 03:52:45 more
  • 如何保證外包團隊接入企業內網安全

    不管企業規模的大小,只要企業想省錢,那么企業的某些服務就一定會采用外包的形式,然而看似美好又經濟的策略,其實也有不好的一面。下面我通過安全的角度來聊聊使用外包團的安全隱患問題。 先看看什么服務會使用外包的,最常見的就是話務/客服這種需要大量重復性、無技術性的服務,或者是一些銷售外包、特殊的職能外包等 ......

    uj5u.com 2020-09-10 03:52:57 more
  • PHP漏洞之【整型數字型SQL注入】

    0x01 什么是SQL注入 SQL是一種注入攻擊,通過前端帶入后端資料庫進行惡意的SQL陳述句查詢。 0x02 SQL整型注入原理 SQL注入一般發生在動態網站URL地址里,當然也會發生在其它地發,如登錄框等等也會存在注入,只要是和資料庫打交道的地方都有可能存在。 如這里http://192.168. ......

    uj5u.com 2020-09-10 03:55:40 more
  • [GXYCTF2019]禁止套娃

    git泄露獲取原始碼 使用GET傳參,引數為exp 經過三層過濾執行 第一層過濾偽協議,第二層過濾帶引數的函式,第三層過濾一些函式 preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'] (?R)參考當前正則運算式,相當于匹配函式里的引數 因此傳遞 ......

    uj5u.com 2020-09-10 03:56:07 more
  • 等保2.0實施流程

    流程 結論 ......

    uj5u.com 2020-09-10 03:56:16 more
最新发布
  • 使用Django Rest framework搭建Blog

    在前面的Blog例子中我們使用的是GraphQL, 雖然GraphQL的使用處于上升趨勢,但是Rest API還是使用的更廣泛一些. 所以還是決定回到傳統的rest api framework上來, Django rest framework的官網上給了一個很好用的QuickStart, 我參考Qu ......

    uj5u.com 2023-04-20 08:17:54 more
  • 記錄-new Date() 我忍你很久了!

    這里給大家分享我在網上總結出來的一些知識,希望對大家有所幫助 大家平時在開發的時候有沒被new Date()折磨過?就是它的諸多怪異的設定讓你每每用的時候,都可能不小心踩坑。造成程式意外出錯,卻一下子找不到問題出處,那叫一個煩透了…… 下面,我就列舉它的“四宗罪”及應用思考 可惡的四宗罪 1. Sa ......

    uj5u.com 2023-04-20 08:17:47 more
  • 使用Vue.js實作文字跑馬燈效果

    實作文字跑馬燈效果,首先用到 substring()截取 和 setInterval計時器 clearInterval()清除計時器 效果如下: 實作代碼如下: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta ......

    uj5u.com 2023-04-20 08:12:31 more
  • JavaScript 運算子

    JavaScript 運算子/運算子 在 JavaScript 中,有一些運算子可以使代碼更簡潔、易讀和高效。以下是一些常見的運算子: 1、可選鏈運算子(optional chaining operator) ?.是可選鏈運算子(optional chaining operator)。?. 可選鏈操 ......

    uj5u.com 2023-04-20 08:02:25 more
  • CSS—相對單位rem

    一、概述 rem是一個相對長度單位,它的單位長度取決于根標簽html的字體尺寸。rem即root em的意思,中文翻譯為根em。瀏覽器的文本尺寸一般默認為16px,即默認情況下: 1rem = 16px rem布局原理:根據CSS媒體查詢功能,更改根標簽的字體尺寸,實作rem單位隨螢屏尺寸的變化,如 ......

    uj5u.com 2023-04-20 08:02:21 more
  • 我的第一個NPM包:panghu-planebattle-esm(胖虎飛機大戰)使用說明

    好家伙,我的包終于開發完啦 歡迎使用胖虎的飛機大戰包!! 為你的主頁添加色彩 這是一個有趣的網頁小游戲包,使用canvas和js開發 使用ES6模塊化開發 效果圖如下: (覺得圖片太sb的可以自己改) 代碼已開源!! Git: https://gitee.com/tang-and-han-dynas ......

    uj5u.com 2023-04-20 08:01:50 more
  • 如何在 vue3 中使用 jsx/tsx?

    我們都知道,通常情況下我們使用 vue 大多都是用的 SFC(Signle File Component)單檔案組件模式,即一個組件就是一個檔案,但其實 Vue 也是支持使用 JSX 來撰寫組件的。這里不討論 SFC 和 JSX 的好壞,這個仁者見仁智者見智。本篇文章旨在帶領大家快速了解和使用 Vu ......

    uj5u.com 2023-04-20 08:01:37 more
  • 【Vue2.x原始碼系列06】計算屬性computed原理

    本章目標:計算屬性是如何實作的?計算屬性快取原理以及洋蔥模型的應用?在初始化Vue實體時,我們會給每個計算屬性都創建一個對應watcher,我們稱之為計算屬性watcher ......

    uj5u.com 2023-04-20 08:01:31 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:01:10 more
  • http1.1與http2.0

    一、http是什么 通俗來講,http就是計算機通過網路進行通信的規則,是一個基于請求與回應,無狀態的,應用層協議。常用于TCP/IP協議傳輸資料。目前任何終端之間任何一種通信方式都必須按Http協議進行,否則無法連接。tcp(三次握手,四次揮手)。 請求與回應:客戶端請求、服務端回應資料。 無狀態 ......

    uj5u.com 2023-04-20 08:00:32 more