问:
Stuck Between "OOM" Error and "NaN loss during training" Error When Adjusting Batch Size
I'm new to Tensorflow!
I'm trying to train an object detection model using a 8GB 3060ti FE GPU using Tensorflow1 (not 2) Version is 1.15.5. I am doing Tensorflow 1 because I know the ssd_mobilenet_v2_quantized model works for my very old Android Device.

The problem I'm running into is with a batch size of 16, I get an OOM Error (Out Of Memory). The universal fix online is to lower batch size. When I do this, I get different error of "NaN loss during training." The universal fix for this is to increase batch size. I'm suck in this loop. I've also tried a batch size of every number between 8-16 and all give one of the two errors.

PC specs
i7-3770 CPU
16 GB DDR3 system RAM
1TB SSD
GeForce RTX 3060 Ti GPU
Windows 10

I am training with this Repo: https://github.com/ssysm/FTC-TFoD
Following this tutorial: https://www.youtube.com/watch?v=1_tFzuxQ-FM&t=233s

pipeline.config file:

```<code>model {
  ssd {
    num_classes: 1
    image_resizer {
      fixed_shape_resizer {
        height: 300
        width: 300
      }
    }
    feature_extractor {
      type: "ssd_mobilenet_v2"
      depth_multiplier: 1.0
      min_depth: 16
      conv_hyperparams {
        regularizer {
          l2_regularizer {
            weight: 3.99999989895e-05
          }
        }
        initializer {
          truncated_normal_initializer {
            mean: 0.0
            stddev: 0.0299999993294
          }
        }
        activation: RELU_6
        batch_norm {
          decay: 0.999700009823
          center: true
          scale: true
          epsilon: 0.0010000000475
          train: true
        }
      }
    }
    box_coder {
      faster_rcnn_box_coder {
        y_scale: 10.0
        x_scale: 10.0
        height_scale: 5.0
        width_scale: 5.0
      }
    }
    matcher {
      argmax_matcher {
        matched_threshold: 0.5
        unmatched_threshold: 0.5
        ignore_thresholds: false
        negatives_lower_than_unmatched: true
        force_match_for_each_row: true
      }
    }
    similarity_calculator {
      iou_similarity {
      }
    }
    box_predictor {
      convolutional_box_predictor {
        conv_hyperparams {
          regularizer {
            l2_regularizer {
              weight: 3.99999989895e-05
            }
          }
          initializer {
            truncated_normal_initializer {
              mean: 0.0
              stddev: 0.0299999993294
            }
          }
          activation: RELU_6
          batch_norm {
            decay: 0.999700009823
            center: true
            scale: true
            epsilon: 0.0010000000475
            train: true
          }
        }
        min_depth: 0
        max_depth: 0
        num_layers_before_predictor: 0
        use_dropout: false
        dropout_keep_probability: 0.800000011921
        kernel_size: 1
        box_code_size: 4
        apply_sigmoid_to_scores: false
      }
    }
    anchor_generator {
      ssd_anchor_generator {
        num_layers: 6
        min_scale: 0.20000000298
        max_scale: 0.949999988079
        aspect_ratios: 1.0
        aspect_ratios: 2.0
        aspect_ratios: 0.5
        aspect_ratios: 3.0
        aspect_ratios: 0.333299994469
      }
    }
    post_processing {
      batch_non_max_suppression {
        score_threshold: 9.99999993923e-09
        iou_threshold: 0.600000023842
        max_detections_per_class: 100
        max_total_detections: 100
      }
      score_converter: SIGMOID
    }
    normalize_loss_by_num_matches: true
    loss {
      localization_loss {
        weighted_smooth_l1 {
        }
      }
      classification_loss {
        weighted_sigmoid {
        }
      }
      hard_example_miner {
        num_hard_examples: 3000
        iou_threshold: 0.990000009537
        loss_type: CLASSIFICATION
        max_negatives_per_positive: 3
        min_negatives_per_image: 3
      }
      classification_weight: 1.0
      localization_weight: 1.0
    }
  }
}
train_config {
  batch_size: 8
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
  data_augmentation_options {
    ssd_random_crop {
    }
  }
  optimizer {
    rms_prop_optimizer {
      learning_rate {
        exponential_decay_learning_rate {
          initial_learning_rate: 0.00400000018999
          decay_steps: 800720
          decay_factor: 0.949999988079
        }
      }
      momentum_optimizer_value: 0.899999976158
      decay: 0.899999976158
      epsilon: 1.0
    }
  }
  fine_tune_checkpoint: "C:/Users/tnfal/TF-FTC-Master/models/ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03/model.ckpt"
  from_detection_checkpoint: true
  num_steps: 30000
}
train_input_reader {
  label_map_path: "C:/Users/tnfal/TF-FTC-Master/train_data/label.pbtxt"
  tf_record_input_reader {
    input_path: "C:/Users/tnfal/TF-FTC-Master/train_data/train-??.record"
  }
}
eval_config {
  num_examples: 20
  metrics_set: "coco_detection_metrics"
}
eval_input_reader {
  label_map_path: "C:/Users/tnfal/TF-FTC-Master/train_data/label.pbtxt"
  shuffle: true
  num_readers: 1
  tf_record_input_reader {
    input_path: "C:/Users/tnfal/TF-FTC-Master/train_data/eval-??.record"
  }
}
graph_rewriter {
  quantization {
    delay: 48000
    weight_bits: 8
    activation_bits: 8
  }
}

</code>```

I'm using model_main.py with minimal changes:

```<code># Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Binary to run train and evaluation on object detection model."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow.compat.v1 import estimator as tf_estimator

from object_detection import model_lib
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession

gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=1)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

config = ConfigProto()
config.gpu_options.allow_growth = True

#session = tf.InteractiveSession(config=tf.ConfigProto(gpu_options=gpu_options))

sess = tf.Session(config=config)

flags.DEFINE_string(
    'model_dir', None, 'Path to output model directory '
    'where event and checkpoint files will be written.')
flags.DEFINE_string('pipeline_config_path', None, 'Path to pipeline config '
                    'file.')
flags.DEFINE_integer('num_train_steps', None, 'Number of train steps.')
flags.DEFINE_boolean('eval_training_data', False,
                     'If training data should be evaluated for this job. Note '
                     'that one call only use this in eval-only mode, and '
                     '`checkpoint_dir` must be supplied.')
flags.DEFINE_integer('sample_1_of_n_eval_examples', 1, 'Will sample one of '
                     'every n eval input examples, where n is provided.')
flags.DEFINE_integer('sample_1_of_n_eval_on_train_examples', 5, 'Will sample '
                     'one of every n train input examples for evaluation, '
                     'where n is provided. This is only used if '
                     '`eval_training_data` is True.')
flags.DEFINE_string(
    'checkpoint_dir', None, 'Path to directory holding a checkpoint.  If '
    '`checkpoint_dir` is provided, this binary operates in eval-only mode, '
    'writing resulting metrics to `model_dir`.')
flags.DEFINE_boolean(
    'run_once', False, 'If running in eval-only mode, whether to run just '
    'one round of eval vs running continuously (default).'
)
flags.DEFINE_integer(
    'max_eval_retries', 0, 'If running continuous eval, the maximum number of '
    'retries upon encountering tf.errors.InvalidArgumentError. If negative, '
    'will always retry the evaluation.'
)

FLAGS = flags.FLAGS

def main(unused_argv):
  flags.mark_flag_as_required('model_dir')
  flags.mark_flag_as_required('pipeline_config_path')
  config = tf_estimator.RunConfig(model_dir=FLAGS.model_dir)

  train_and_eval_dict = model_lib.create_estimator_and_inputs(
      run_config=config,
      pipeline_config_path=FLAGS.pipeline_config_path,
      train_steps=FLAGS.num_train_steps,
      sample_1_of_n_eval_examples=FLAGS.sample_1_of_n_eval_examples,
      sample_1_of_n_eval_on_train_examples=(
          FLAGS.sample_1_of_n_eval_on_train_examples))
  estimator = train_and_eval_dict['estimator']
  train_input_fn = train_and_eval_dict['train_input_fn']
  eval_input_fns = train_and_eval_dict['eval_input_fns']
  eval_on_train_input_fn = train_and_eval_dict['eval_on_train_input_fn']
  predict_input_fn = train_and_eval_dict['predict_input_fn']
  train_steps = train_and_eval_dict['train_steps']

  if FLAGS.checkpoint_dir:
    if FLAGS.eval_training_data:
      name = 'training_data'
      input_fn = eval_on_train_input_fn
    else:
      name = 'validation_data'
      # The first eval input will be evaluated.
      input_fn = eval_input_fns[0]
    if FLAGS.run_once:
      estimator.evaluate(input_fn,
                         steps=None,
                         checkpoint_path=tf.train.latest_checkpoint(
                             FLAGS.checkpoint_dir))
    else:
      model_lib.continuous_eval(estimator, FLAGS.checkpoint_dir, input_fn,
                                train_steps, name, FLAGS.max_eval_retries)
  else:
    train_spec, eval_specs = model_lib.create_train_and_eval_specs(
        train_input_fn,
        eval_input_fns,
        eval_on_train_input_fn,
        predict_input_fn,
        train_steps,
        eval_on_train_data=False)

    # Currently only a single Eval Spec is allowed.
    tf_estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])

if __name__ == '__main__':
  tf.app.run()

</code>```

Errors in full:

NaN loss Error

```<code>ERROR:tensorflow:Model diverged with loss = NaN.
E0109 19:13:41.056800 23808 basic_session_run_hooks.py:760] Model diverged with loss = NaN.
Traceback (most recent call last):
  File "C:\Users\tnfal\models\research\object_detection\model_main.py", line 121, in <module>
    tf.app.run()
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\absl\app.py", line 308, in run
    _run_main(main, args)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\absl\app.py", line 254, in _run_main
    sys.exit(main(argv))
  File "C:\Users\tnfal\models\research\object_detection\model_main.py", line 117, in main
    tf_estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\training.py", line 473, in train_and_evaluate
    return executor.run()
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\training.py", line 613, in run
    return self.run_local()
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\training.py", line 714, in run_local
    saving_listeners=saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 370, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1161, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1195, in _train_model_default
    saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1494, in _train_with_estimator_spec
    _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss])
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 754, in run
    run_metadata=run_metadata)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1259, in run
    run_metadata=run_metadata)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1360, in run
    raise six.reraise(*original_exc_info)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\six.py", line 719, in reraise
    raise value
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1345, in run
    return self._sess.run(*args, **kwargs)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1426, in run
    run_metadata=run_metadata))
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\basic_session_run_hooks.py", line 761, in after_run
    raise NanLossDuringTrainingError
tensorflow.python.training.basic_session_run_hooks.NanLossDuringTrainingError: NaN loss during training.
</code>```

OOM:

```<code>

2023-01-09 18:55:57.068293: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 5914624 totalling 5.64MiB
2023-01-09 18:55:57.068373: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 12 Chunks of size 6144000 totalling 70.31MiB
2023-01-09 18:55:57.068455: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 2 Chunks of size 8192000 totalling 15.63MiB
2023-01-09 18:55:57.068536: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 14 Chunks of size 8640000 totalling 115.36MiB
2023-01-09 18:55:57.068617: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 56 Chunks of size 8871936 totalling 473.81MiB
2023-01-09 18:55:57.068698: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 21 Chunks of size 13307904 totalling 266.52MiB
2023-01-09 18:55:57.068779: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 14870528 totalling 14.18MiB
2023-01-09 18:55:57.068863: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 2 Chunks of size 17280000 totalling 32.96MiB
2023-01-09 18:55:57.068970: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 35 Chunks of size 17743872 totalling 592.27MiB
2023-01-09 18:55:57.069077: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 6 Chunks of size 23040000 totalling 131.84MiB
2023-01-09 18:55:57.069181: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 24104448 totalling 22.99MiB
2023-01-09 18:55:57.069285: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 25224192 totalling 24.06MiB
2023-01-09 18:55:57.069389: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 7 Chunks of size 34560000 totalling 230.71MiB
2023-01-09 18:55:57.069492: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 14 Chunks of size 46080000 totalling 615.23MiB
2023-01-09 18:55:57.069596: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 21 Chunks of size 51840000 totalling 1.01GiB
2023-01-09 18:55:57.069700: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 7 Chunks of size 138240000 totalling 922.85MiB
2023-01-09 18:55:57.069802: I tensorflow/core/common_runtime/bfc_allocator.cc:921] Sum Total of in-use chunks: 4.79GiB
2023-01-09 18:55:57.069904: I tensorflow/core/common_runtime/bfc_allocator.cc:923] total_region_allocated_bytes_: 5153567488 memory_limit_: 5153567539 available bytes: 51 curr_region_allocation_bytes_: 10307135488
2023-01-09 18:55:57.070014: I tensorflow/core/common_runtime/bfc_allocator.cc:929] Stats:
Limit:                  5153567539
InUse:                  5145408768
MaxInUse:               5145409280
NumAllocs:                    5610
MaxAllocSize:            965214208

2023-01-09 18:55:57.070325: W tensorflow/core/common_runtime/bfc_allocator.cc:424] ****************************************************************************************************
2023-01-09 18:55:57.070443: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at fake_quant_ops.cc:242 : Resource exhausted: OOM when allocating tensor with shape[16,19,19,576] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
</code>```

I have already tried a system reboot, relabeling all training images, lowering image quality from 1080p-460p, deleting all info in the "saved_model"/checkpoint folder, and decreasing training rate.

I would hope that it would just run the model training at decent speed compared to CPU (which I did get working)

Body:
I'm new to Tensorflow!
I'm trying to train an object detection model using a 8GB 3060ti FE GPU using Tensorflow1 (not 2) Version is 1.15.5. I am doing Tensorflow 1 because I know the ssd_mobilenet_v2_quantized model works for my very old Android Device.

The problem I'm running into is with a batch size of 16, I get an OOM Error (Out Of Memory). The universal fix online is to lower batch size. When I do this, I get different error of "NaN loss during training." The universal fix for this is to increase batch size. I'm suck in this loop. I've also tried a batch size of every number between 8-16 and all give one of the two errors.

PC specs
i7-3770 CPU
16 GB DDR3 system RAM
1TB SSD
GeForce RTX 3060 Ti GPU
Windows 10

I am training with this Repo: https://github.com/ssysm/FTC-TFoD
Following this tutorial: https://www.youtube.com/watch?v=1_tFzuxQ-FM&t=233s

pipeline.config file:

model {
  ssd {
    num_classes: 1
    image_resizer {
      fixed_shape_resizer {
        height: 300
        width: 300
      }
    }
    feature_extractor {
      type: "ssd_mobilenet_v2"
      depth_multiplier: 1.0
      min_depth: 16
      conv_hyperparams {
        regularizer {
          l2_regularizer {
            weight: 3.99999989895e-05
          }
        }
        initializer {
          truncated_normal_initializer {
            mean: 0.0
            stddev: 0.0299999993294
          }
        }
        activation: RELU_6
        batch_norm {
          decay: 0.999700009823
          center: true
          scale: true
          epsilon: 0.0010000000475
          train: true
        }
      }
    }
    box_coder {
      faster_rcnn_box_coder {
        y_scale: 10.0
        x_scale: 10.0
        height_scale: 5.0
        width_scale: 5.0
      }
    }
    matcher {
      argmax_matcher {
        matched_threshold: 0.5
        unmatched_threshold: 0.5
        ignore_thresholds: false
        negatives_lower_than_unmatched: true
        force_match_for_each_row: true
      }
    }
    similarity_calculator {
      iou_similarity {
      }
    }
    box_predictor {
      convolutional_box_predictor {
        conv_hyperparams {
          regularizer {
            l2_regularizer {
              weight: 3.99999989895e-05
            }
          }
          initializer {
            truncated_normal_initializer {
              mean: 0.0
              stddev: 0.0299999993294
            }
          }
          activation: RELU_6
          batch_norm {
            decay: 0.999700009823
            center: true
            scale: true
            epsilon: 0.0010000000475
            train: true
          }
        }
        min_depth: 0
        max_depth: 0
        num_layers_before_predictor: 0
        use_dropout: false
        dropout_keep_probability: 0.800000011921
        kernel_size: 1
        box_code_size: 4
        apply_sigmoid_to_scores: false
      }
    }
    anchor_generator {
      ssd_anchor_generator {
        num_layers: 6
        min_scale: 0.20000000298
        max_scale: 0.949999988079
        aspect_ratios: 1.0
        aspect_ratios: 2.0
        aspect_ratios: 0.5
        aspect_ratios: 3.0
        aspect_ratios: 0.333299994469
      }
    }
    post_processing {
      batch_non_max_suppression {
        score_threshold: 9.99999993923e-09
        iou_threshold: 0.600000023842
        max_detections_per_class: 100
        max_total_detections: 100
      }
      score_converter: SIGMOID
    }
    normalize_loss_by_num_matches: true
    loss {
      localization_loss {
        weighted_smooth_l1 {
        }
      }
      classification_loss {
        weighted_sigmoid {
        }
      }
      hard_example_miner {
        num_hard_examples: 3000
        iou_threshold: 0.990000009537
        loss_type: CLASSIFICATION
        max_negatives_per_positive: 3
        min_negatives_per_image: 3
      }
      classification_weight: 1.0
      localization_weight: 1.0
    }
  }
}
train_config {
  batch_size: 8
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
  data_augmentation_options {
    ssd_random_crop {
    }
  }
  optimizer {
    rms_prop_optimizer {
      learning_rate {
        exponential_decay_learning_rate {
          initial_learning_rate: 0.00400000018999
          decay_steps: 800720
          decay_factor: 0.949999988079
        }
      }
      momentum_optimizer_value: 0.899999976158
      decay: 0.899999976158
      epsilon: 1.0
    }
  }
  fine_tune_checkpoint: "C:/Users/tnfal/TF-FTC-Master/models/ssd_mobilenet_v2_quantized_300x300_coco_2019_01_03/model.ckpt"
  from_detection_checkpoint: true
  num_steps: 30000
}
train_input_reader {
  label_map_path: "C:/Users/tnfal/TF-FTC-Master/train_data/label.pbtxt"
  tf_record_input_reader {
    input_path: "C:/Users/tnfal/TF-FTC-Master/train_data/train-??.record"
  }
}
eval_config {
  num_examples: 20
  metrics_set: "coco_detection_metrics"
}
eval_input_reader {
  label_map_path: "C:/Users/tnfal/TF-FTC-Master/train_data/label.pbtxt"
  shuffle: true
  num_readers: 1
  tf_record_input_reader {
    input_path: "C:/Users/tnfal/TF-FTC-Master/train_data/eval-??.record"
  }
}
graph_rewriter {
  quantization {
    delay: 48000
    weight_bits: 8
    activation_bits: 8
  }
}

I'm using model_main.py with minimal changes:

# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Binary to run train and evaluation on object detection model."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from absl import flags

import tensorflow.compat.v1 as tf
from tensorflow.compat.v1 import estimator as tf_estimator

from object_detection import model_lib
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession

gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=1)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))

config = ConfigProto()
config.gpu_options.allow_growth = True

#session = tf.InteractiveSession(config=tf.ConfigProto(gpu_options=gpu_options))

sess = tf.Session(config=config)

flags.DEFINE_string(
    'model_dir', None, 'Path to output model directory '
    'where event and checkpoint files will be written.')
flags.DEFINE_string('pipeline_config_path', None, 'Path to pipeline config '
                    'file.')
flags.DEFINE_integer('num_train_steps', None, 'Number of train steps.')
flags.DEFINE_boolean('eval_training_data', False,
                     'If training data should be evaluated for this job. Note '
                     'that one call only use this in eval-only mode, and '
                     '`checkpoint_dir` must be supplied.')
flags.DEFINE_integer('sample_1_of_n_eval_examples', 1, 'Will sample one of '
                     'every n eval input examples, where n is provided.')
flags.DEFINE_integer('sample_1_of_n_eval_on_train_examples', 5, 'Will sample '
                     'one of every n train input examples for evaluation, '
                     'where n is provided. This is only used if '
                     '`eval_training_data` is True.')
flags.DEFINE_string(
    'checkpoint_dir', None, 'Path to directory holding a checkpoint.  If '
    '`checkpoint_dir` is provided, this binary operates in eval-only mode, '
    'writing resulting metrics to `model_dir`.')
flags.DEFINE_boolean(
    'run_once', False, 'If running in eval-only mode, whether to run just '
    'one round of eval vs running continuously (default).'
)
flags.DEFINE_integer(
    'max_eval_retries', 0, 'If running continuous eval, the maximum number of '
    'retries upon encountering tf.errors.InvalidArgumentError. If negative, '
    'will always retry the evaluation.'
)

FLAGS = flags.FLAGS

def main(unused_argv):
  flags.mark_flag_as_required('model_dir')
  flags.mark_flag_as_required('pipeline_config_path')
  config = tf_estimator.RunConfig(model_dir=FLAGS.model_dir)

  train_and_eval_dict = model_lib.create_estimator_and_inputs(
      run_config=config,
      pipeline_config_path=FLAGS.pipeline_config_path,
      train_steps=FLAGS.num_train_steps,
      sample_1_of_n_eval_examples=FLAGS.sample_1_of_n_eval_examples,
      sample_1_of_n_eval_on_train_examples=(
          FLAGS.sample_1_of_n_eval_on_train_examples))
  estimator = train_and_eval_dict['estimator']
  train_input_fn = train_and_eval_dict['train_input_fn']
  eval_input_fns = train_and_eval_dict['eval_input_fns']
  eval_on_train_input_fn = train_and_eval_dict['eval_on_train_input_fn']
  predict_input_fn = train_and_eval_dict['predict_input_fn']
  train_steps = train_and_eval_dict['train_steps']

  if FLAGS.checkpoint_dir:
    if FLAGS.eval_training_data:
      name = 'training_data'
      input_fn = eval_on_train_input_fn
    else:
      name = 'validation_data'
      # The first eval input will be evaluated.
      input_fn = eval_input_fns[0]
    if FLAGS.run_once:
      estimator.evaluate(input_fn,
                         steps=None,
                         checkpoint_path=tf.train.latest_checkpoint(
                             FLAGS.checkpoint_dir))
    else:
      model_lib.continuous_eval(estimator, FLAGS.checkpoint_dir, input_fn,
                                train_steps, name, FLAGS.max_eval_retries)
  else:
    train_spec, eval_specs = model_lib.create_train_and_eval_specs(
        train_input_fn,
        eval_input_fns,
        eval_on_train_input_fn,
        predict_input_fn,
        train_steps,
        eval_on_train_data=False)

    # Currently only a single Eval Spec is allowed.
    tf_estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])

if __name__ == '__main__':
  tf.app.run()

Errors in full:

NaN loss Error

ERROR:tensorflow:Model diverged with loss = NaN.
E0109 19:13:41.056800 23808 basic_session_run_hooks.py:760] Model diverged with loss = NaN.
Traceback (most recent call last):
  File "C:\Users\tnfal\models\research\object_detection\model_main.py", line 121, in <module>
    tf.app.run()
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\platform\app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\absl\app.py", line 308, in run
    _run_main(main, args)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\absl\app.py", line 254, in _run_main
    sys.exit(main(argv))
  File "C:\Users\tnfal\models\research\object_detection\model_main.py", line 117, in main
    tf_estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\training.py", line 473, in train_and_evaluate
    return executor.run()
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\training.py", line 613, in run
    return self.run_local()
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\training.py", line 714, in run_local
    saving_listeners=saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 370, in train
    loss = self._train_model(input_fn, hooks, saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1161, in _train_model
    return self._train_model_default(input_fn, hooks, saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1195, in _train_model_default
    saving_listeners)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 1494, in _train_with_estimator_spec
    _, loss = mon_sess.run([estimator_spec.train_op, estimator_spec.loss])
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 754, in run
    run_metadata=run_metadata)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1259, in run
    run_metadata=run_metadata)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1360, in run
    raise six.reraise(*original_exc_info)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\six.py", line 719, in reraise
    raise value
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1345, in run
    return self._sess.run(*args, **kwargs)
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\monitored_session.py", line 1426, in run
    run_metadata=run_metadata))
  File "C:\Users\tnfal\.conda\envs\tf1\lib\site-packages\tensorflow_core\python\training\basic_session_run_hooks.py", line 761, in after_run
    raise NanLossDuringTrainingError
tensorflow.python.training.basic_session_run_hooks.NanLossDuringTrainingError: NaN loss during training.

OOM:

2023-01-09 18:55:57.068293: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 5914624 totalling 5.64MiB
2023-01-09 18:55:57.068373: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 12 Chunks of size 6144000 totalling 70.31MiB
2023-01-09 18:55:57.068455: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 2 Chunks of size 8192000 totalling 15.63MiB
2023-01-09 18:55:57.068536: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 14 Chunks of size 8640000 totalling 115.36MiB
2023-01-09 18:55:57.068617: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 56 Chunks of size 8871936 totalling 473.81MiB
2023-01-09 18:55:57.068698: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 21 Chunks of size 13307904 totalling 266.52MiB
2023-01-09 18:55:57.068779: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 14870528 totalling 14.18MiB
2023-01-09 18:55:57.068863: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 2 Chunks of size 17280000 totalling 32.96MiB
2023-01-09 18:55:57.068970: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 35 Chunks of size 17743872 totalling 592.27MiB
2023-01-09 18:55:57.069077: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 6 Chunks of size 23040000 totalling 131.84MiB
2023-01-09 18:55:57.069181: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 24104448 totalling 22.99MiB
2023-01-09 18:55:57.069285: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 1 Chunks of size 25224192 totalling 24.06MiB
2023-01-09 18:55:57.069389: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 7 Chunks of size 34560000 totalling 230.71MiB
2023-01-09 18:55:57.069492: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 14 Chunks of size 46080000 totalling 615.23MiB
2023-01-09 18:55:57.069596: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 21 Chunks of size 51840000 totalling 1.01GiB
2023-01-09 18:55:57.069700: I tensorflow/core/common_runtime/bfc_allocator.cc:917] 7 Chunks of size 138240000 totalling 922.85MiB
2023-01-09 18:55:57.069802: I tensorflow/core/common_runtime/bfc_allocator.cc:921] Sum Total of in-use chunks: 4.79GiB
2023-01-09 18:55:57.069904: I tensorflow/core/common_runtime/bfc_allocator.cc:923] total_region_allocated_bytes_: 5153567488 memory_limit_: 5153567539 available bytes: 51 curr_region_allocation_bytes_: 10307135488
2023-01-09 18:55:57.070014: I tensorflow/core/common_runtime/bfc_allocator.cc:929] Stats:
Limit:                  5153567539
InUse:                  5145408768
MaxInUse:               5145409280
NumAllocs:                    5610
MaxAllocSize:            965214208

2023-01-09 18:55:57.070325: W tensorflow/core/common_runtime/bfc_allocator.cc:424] ****************************************************************************************************
2023-01-09 18:55:57.070443: W tensorflow/core/framework/op_kernel.cc:1651] OP_REQUIRES failed at fake_quant_ops.cc:242 : Resource exhausted: OOM when allocating tensor with shape[16,19,19,576] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc

I have already tried a system reboot, relabeling all training images, lowering image quality from 1080p-460p, deleting all info in the "saved_model"/checkpoint folder, and decreasing training rate.

I would hope that it would just run the model training at decent speed compared to CPU (which I did get working)


来源: stackexchange

问:
Sending axios post request returns ERR_BAD_RESPONSE
Im trying to write a simple bowling API on a webserver using expressJS along with a client via the terminal. The terminal sends HTTP request to the webserver to be processed and print out its response. I have 3 relatively simple endpoints to start a game, record a frame, and send current scores. The start endpoint works as intended but when trying run the record endpoint I receive a ERR_BAD_RESPONSE error. Here's the endpoint.
Heres the server code with 3 endpoints:

```<code>    const express = require('express');
    const axios = require('axios');

    const app = express();

    // Set up a hash map to store the scores for each player
    const scores = {};

    // Set up the API routes

    // Route to start a new game with up to 8 players
    app.get('/start', (req, res) => {
      // Initialize the scores for each player to 0
      for (let i = 1; i <= 8; i++) {
        scores[`player${i}`] = 0;
      }
      res.send(`Started a new game with up to 8 players!`);
    });

    // Route to record the result of a frame for a player
    app.use(express.json());

    app.post('/record', (req, res) => {
      const player = req.body.data.player;
      const score = req.body.data.score;
      scores[player] += score;
      res.send(`Recorded score of ${score} for ${player}`);
    });

    // Route to display the current scores for each player
    app.get('/scores', (req, res) => {
      res.send(scores);
    });

    // Start the server
    app.listen(3000, () => {
      console.log('Server listening on port 3000');
    });
</code>```

Client code:

```<code>const axios = require('axios');
const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

const baseURL = 'http://localhost:3000';

console.log('Welcome to the bowling API!');
async function client(){
  let optionSelect =  await rl.question("Please select an option:\n1)Start a game\n2)Record a frame\n3)Send scores\n", async (option) => {
    if(option === "1"){
      await axios.get('http://localhost:3000/start')
      .then(response => console.log(response.data))
      .catch(error => console.log(error));
      client();
    } else if(option === "2"){
      await axios.post('http://localhost:3000/record', {
        data: {
          player: 'player1',
          score: 10
        }
    })
      .then(response => console.log(response.data))
      .catch(error => console.log(error));
      client();
    } else if(option === "3"){
      await axios.get('http://localhost:3000/scores')
      .then(response => console.log(response.data))
      .catch(error => console.log(error));
      client();
    } else{
      console.log('Bad input selected bye bye');
      return;
    }});
}
client();
</code>```

Heres the output:

```<code>$ node app.js&
[1] 1050

Chris@DESKTOP-E7JGMQ2 MINGW64 ~/rectangleHealth (main)
$ node otherclient.js
Welcome to the bowling API!
Please select an option:
1)Start a game
2)Record a frame
3)Send scores
1
Started a new game with up to 8 players!
Please select an option:
1)Start a game
2)Record a frame
3)Send scores
2
AxiosError: Request failed with status code 500
    at settle (C:\Users\cmb\rectangleHealth\node_modules\axios\dist\node\axios.c
js:1859:12)
    at IncomingMessage.handleStreamEnd (C:\Users\cmb\rectangleHealth\node_module
s\axios\dist\node\axios.cjs:2723:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:2
1) {
  code: 'ERR_BAD_RESPONSE',
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Im trying to write a simple bowling API on a webserver using expressJS along with a client via the terminal. The terminal sends HTTP request to the webserver to be processed and print out its response. I have 3 relatively simple endpoints to start a game, record a frame, and send current scores. The start endpoint works as intended but when trying run the record endpoint I receive a ERR_BAD_RESPONSE error. Here's the endpoint.
Heres the server code with 3 endpoints:

    const express = require('express');
    const axios = require('axios');

    const app = express();

    // Set up a hash map to store the scores for each player
    const scores = {};

    // Set up the API routes

    // Route to start a new game with up to 8 players
    app.get('/start', (req, res) => {
      // Initialize the scores for each player to 0
      for (let i = 1; i <= 8; i++) {
        scores[`player${i}`] = 0;
      }
      res.send(`Started a new game with up to 8 players!`);
    });

    // Route to record the result of a frame for a player
    app.use(express.json());

    app.post('/record', (req, res) => {
      const player = req.body.data.player;
      const score = req.body.data.score;
      scores[player] += score;
      res.send(`Recorded score of ${score} for ${player}`);
    });

    // Route to display the current scores for each player
    app.get('/scores', (req, res) => {
      res.send(scores);
    });

    // Start the server
    app.listen(3000, () => {
      console.log('Server listening on port 3000');
    });

Client code:

const axios = require('axios');
const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

const baseURL = 'http://localhost:3000';

console.log('Welcome to the bowling API!');
async function client(){
  let optionSelect =  await rl.question("Please select an option:\n1)Start a game\n2)Record a frame\n3)Send scores\n", async (option) => {
    if(option === "1"){
      await axios.get('http://localhost:3000/start')
      .then(response => console.log(response.data))
      .catch(error => console.log(error));
      client();
    } else if(option === "2"){
      await axios.post('http://localhost:3000/record', {
        data: {
          player: 'player1',
          score: 10
        }
    })
      .then(response => console.log(response.data))
      .catch(error => console.log(error));
      client();
    } else if(option === "3"){
      await axios.get('http://localhost:3000/scores')
      .then(response => console.log(response.data))
      .catch(error => console.log(error));
      client();
    } else{
      console.log('Bad input selected bye bye');
      return;
    }});
}
client();

Heres the output:

$ node app.js&
[1] 1050

Chris@DESKTOP-E7JGMQ2 MINGW64 ~/rectangleHealth (main)
$ node otherclient.js
Welcome to the bowling API!
Please select an option:
1)Start a game
2)Record a frame
3)Send scores
1
Started a new game with up to 8 players!
Please select an option:
1)Start a game
2)Record a frame
3)Send scores
2
AxiosError: Request failed with status code 500
    at settle (C:\Users\cmb\rectangleHealth\node_modules\axios\dist\node\axios.c
js:1859:12)
    at IncomingMessage.handleStreamEnd (C:\Users\cmb\rectangleHealth\node_module
s\axios\dist\node\axios.cjs:2723:11)
    at IncomingMessage.emit (node:events:525:35)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:2
1) {
  code: 'ERR_BAD_RESPONSE',


问:
KeyError handling python using a try/except statement?
I have my function here that iterates through each table listed in a different config file:

```<code>def DBCount(self, db_count_dict):
    schema= self.config["data-validation"]["database"]["schema"]
    unique_cols= self.config["data-validation"]["RULES"]["RULE_UNIQUE_VALIDATION"]["UNIQUE_TABLES"][self.table].split(",")
    db_count_dict[self.table]={}

    for i in range(len(unique_cols)):
        try:
            cnxn=None
            cnxn = SourceValidation.getDBConnection(self.env)
            cursor = cnxn.cursor()
            print("UNIQUE COL: "+str(unique_cols[i]))
            unique_count_query = "SELECT COUNT(DISTINCT "+unique_cols[i]+") as unique_count FROM "+schema+"."+self.table
            df = pd.read_sql(unique_count_query, cnxn)
            db_count_dict[self.table][unique_cols[i]]=str(df['unique_count'].values[0])

        except KeyError:
            pass

    return db_count_dict
</code>```

And here is my config:

```<code>{
  "data-validation": {
    "database": {
      "env": "env",
      "db-server": "ip",
      "port": "0000",
      "username": "user",
      "database": "db_name",
      "schema": "schema_name"
    },
    "allTables": "false",
    "tables": "table1,table2,table3",
    "logLocation": "log",
    "RULES": {
      "RULE_UNIQUE_VALIDATION":{
        "UNIQUE_VALIDATION": true,
        "UNIQUE_TABLES":{
          "table1": "col1",
          "table2": "col1"
        }
       }
      }
    }
  }
</code>```

Basically, the code iterates through each column listed in the config file, doing a unique count on each column I listed. The issue is, if there is a table listed under "all tables" that isn't listed under the "UNIQUE_VALIDATION" rule, it throws a KeyError: 'table3'. So 'table3' isn't listed under my validation, but it's listed in the 'all tables' section so it's throwing a KeyError. I'm not sure if I handled the exception appropriately the way I wrote it above. I want my code to skip over the tables that aren't there instead of throwing a KeyError.

Body:
I have my function here that iterates through each table listed in a different config file:

def DBCount(self, db_count_dict):
    schema= self.config["data-validation"]["database"]["schema"]
    unique_cols= self.config["data-validation"]["RULES"]["RULE_UNIQUE_VALIDATION"]["UNIQUE_TABLES"][self.table].split(",")
    db_count_dict[self.table]={}

    for i in range(len(unique_cols)):
        try:
            cnxn=None
            cnxn = SourceValidation.getDBConnection(self.env)
            cursor = cnxn.cursor()
            print("UNIQUE COL: "+str(unique_cols[i]))
            unique_count_query = "SELECT COUNT(DISTINCT "+unique_cols[i]+") as unique_count FROM "+schema+"."+self.table
            df = pd.read_sql(unique_count_query, cnxn)
            db_count_dict[self.table][unique_cols[i]]=str(df['unique_count'].values[0])

        except KeyError:
            pass

    return db_count_dict

And here is my config:

{
  "data-validation": {
    "database": {
      "env": "env",
      "db-server": "ip",
      "port": "0000",
      "username": "user",
      "database": "db_name",
      "schema": "schema_name"
    },
    "allTables": "false",
    "tables": "table1,table2,table3",
    "logLocation": "log",
    "RULES": {
      "RULE_UNIQUE_VALIDATION":{
        "UNIQUE_VALIDATION": true,
        "UNIQUE_TABLES":{
          "table1": "col1",
          "table2": "col1"
        }
       }
      }
    }
  }

Basically, the code iterates through each column listed in the config file, doing a unique count on each column I listed. The issue is, if there is a table listed under "all tables" that isn't listed under the "UNIQUE_VALIDATION" rule, it throws a KeyError: 'table3'. So 'table3' isn't listed under my validation, but it's listed in the 'all tables' section so it's throwing a KeyError. I'm not sure if I handled the exception appropriately the way I wrote it above. I want my code to skip over the tables that aren't there instead of throwing a KeyError.


问:
How to re-register browser service worker?
I'm developing a service worker and I clicked unregister on it in the dev console (mostly to see what unregister does). But now the service worker is gone and I don't know how to bring it back...</p>


问:
SvelteKit routing [slug] and Spring gateway routes issue
I'm trying to use spring gateway with my sveltekit app, I have some working rest services already integrated in the gateway and I also added the svelte front end in the yml routes.

application.yml

```<code>spring:
  cloud:
    gateway:
      routes:
      - id: svelte
        uri: http://localhost:5173
        predicates:
        - Path=/**
</code>```

localhost:5173 is being routed to localhost:8080 which is the port of the gateway

Regular routing of the SvelteKit UI  like these works:

```<code>http://localhost:8080/items   <----- I can see the item list in the browser
http://localhost:8080/login   <----- I can see the login screen
http://localhost:8080/about   <----- I can see the about page
</code>```

But for routing that uses [slug] for dynamic parameter

```<code>http://localhost:8080/item/1   <-------- error in gateway, and 500 error displays in browser
</code>```

error in console of spring gateway:

```<code>java.net.URISyntaxException: Illegal character in path at index 41: http://localhost:8080/src/routes/item/[slug]/+page.svelte
</code>```

folder hierarchy for the [slug] routing

```<code>src
├── +page.svelte
│   ├── item/
│   │   ├───[slug]
│   │   │   ├──+page.svelte
</code>```

The slug routing works when I am not using gateway, this only happens when the UI is being routed in the gateway.

Body:
I'm trying to use spring gateway with my sveltekit app, I have some working rest services already integrated in the gateway and I also added the svelte front end in the yml routes.

application.yml

spring:
  cloud:
    gateway:
      routes:
      - id: svelte
        uri: http://localhost:5173
        predicates:
        - Path=/**

localhost:5173 is being routed to localhost:8080 which is the port of the gateway

Regular routing of the SvelteKit UI  like these works:

http://localhost:8080/items   <----- I can see the item list in the browser
http://localhost:8080/login   <----- I can see the login screen
http://localhost:8080/about   <----- I can see the about page

But for routing that uses [slug] for dynamic parameter

http://localhost:8080/item/1   <-------- error in gateway, and 500 error displays in browser

error in console of spring gateway:

java.net.URISyntaxException: Illegal character in path at index 41: http://localhost:8080/src/routes/item/[slug]/+page.svelte

folder hierarchy for the [slug] routing

src
├── +page.svelte
│   ├── item/
│   │   ├───[slug]
│   │   │   ├──+page.svelte

The slug routing works when I am not using gateway, this only happens when the UI is being routed in the gateway.


问:
Why does all Jest tests suites fail with "TypeError: (0 , _expect.setState) is not a function"?
I am using Remix.js plus typescript. A test-suite will run fine when I remove the jest.config.js file but error out with "TypeError: (0 , _expect.setState) is not a function". I need my config file in order to run transforms on typescript tests. I will provide the test file and the file I am trying to test as well as all config setup. Not sure how to triage this issue myself. I find it out that a simple config seems to cause this issue.

service.test.ts

```<code>import { fetch } from '@remix-run/node'

import { getGames, mapGamesData } from '../api/service'

const mockFetch = fetch as jest.MockedFn<typeof fetch>
const mockResponse = (mockData: any): Response =>
  ({ json: async () => mockData } as Response)

const mockGames = {
  data: [
    {
      id: 857429,
      date: '2022-10-28T00:00:00.000Z',
      home_team: {
        id: 18,
        abbreviation: 'MIN',
        city: 'Minnesota',
        conference: 'West',
        division: 'Northwest',
        full_name: 'Minnesota Timberwolves',
        name: 'Timberwolves',
      },
      home_team_score: 0,
      period: 0,
      postseason: false,
      season: 2022,
      status: '8:00 PM ET',
      time: '',
      visitor_team: {
        id: 14,
        abbreviation: 'LAL',
        city: 'Los Angeles',
        conference: 'West',
        division: 'Pacific',
        full_name: 'Los Angeles Lakers',
        name: 'Lakers',
      },
      visitor_team_score: 0,
    },
    {
      id: 857440,
      date: '2022-10-29T00:00:00.000Z',
      home_team: {
        id: 7,
        abbreviation: 'DAL',
        city: 'Dallas',
        conference: 'West',
        division: 'Southwest',
        full_name: 'Dallas Mavericks',
        name: 'Mavericks',
      },
      home_team_score: 0,
      period: 0,
      postseason: false,
      season: 2022,
      status: '9:00 PM ET',
      time: '',
      visitor_team: {
        id: 21,
        abbreviation: 'OKC',
        city: 'Oklahoma City',
        conference: 'West',
        division: 'Northwest',
        full_name: 'Oklahoma City Thunder',
        name: 'Thunder',
      },
      visitor_team_score: 0,
    },
  ],
  meta: {
    total_pages: 24,
    current_page: 1,
    next_page: 2,
    per_page: 50,
    total_count: 1161,
  },
}

jest.mock('@remix-run/node', () => ({
  fetch: mockFetch,
}))

describe.skip('getGames', () => {
  beforeEach(() => {
    mockFetch.mockClear()
  })

  it('should return list of games', async () => {
    // mockFetch.mockResolvedValue(mockResponse(mockGames))

    // const expectedResults = await getGames()

    // expect(expectedResults).toEqual(mapGamesData(mockGames.data))

    expect(true).toBeTruthy()
  })
})
</code>```

Jest Config

```<code>/** @type {import(@jest/types).Config.InitialOptions} */

module.exports = {
  collectCoverage: true,
  collectCoverageFrom: [
    '<rootDir>/src/**/*.{js,jsx,ts,tsx}',
    '!**/*.d.ts',
    '!**/entry.*.*',
    '!**/node_modules/**',
    '!**/root.*',
    '!**/routes/**',
    '!**/index.*',
  ],
  coverageDirectory: '<rootDir>/reports',

  coverageReporters: ['json', 'lcov', 'text'],

  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 50,
      statements: 50,
    },
  },

  moduleDirectories: ['node_modules', '<rootDir>/node_modules'],

  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],

  testEnvironment: 'jsdom',

  testPathIgnorePatterns: ['<rootDir>/node_modules/'],

  transform: {
    // https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
    '^.+\\.[jt]sx?$': [
      'babel-jest',
      {
        presets: [
          '@babel/preset-env',
          ['@babel/preset-react', { runtime: 'automatic' }],
          '@babel/preset-typescript',
        ],
        plugins: ['@babel/plugin-transform-runtime'],
      },
    ],
  },
}
</code>```

Jest Setup file

```<code>import '@testing-library/jest-dom/extend-expect'

import { installGlobals } from '@remix-run/node'
import { configure } from '@testing-library/react'

configure({ testIdAttribute: 'data-test' })

installGlobals()
</code>```

Source Code - Dev Branch

Error

Body:
I am using Remix.js plus typescript. A test-suite will run fine when I remove the jest.config.js file but error out with "TypeError: (0 , _expect.setState) is not a function". I need my config file in order to run transforms on typescript tests. I will provide the test file and the file I am trying to test as well as all config setup. Not sure how to triage this issue myself. I find it out that a simple config seems to cause this issue.

service.test.ts

import { fetch } from '@remix-run/node'

import { getGames, mapGamesData } from '../api/service'

const mockFetch = fetch as jest.MockedFn<typeof fetch>
const mockResponse = (mockData: any): Response =>
  ({ json: async () => mockData } as Response)

const mockGames = {
  data: [
    {
      id: 857429,
      date: '2022-10-28T00:00:00.000Z',
      home_team: {
        id: 18,
        abbreviation: 'MIN',
        city: 'Minnesota',
        conference: 'West',
        division: 'Northwest',
        full_name: 'Minnesota Timberwolves',
        name: 'Timberwolves',
      },
      home_team_score: 0,
      period: 0,
      postseason: false,
      season: 2022,
      status: '8:00 PM ET',
      time: '',
      visitor_team: {
        id: 14,
        abbreviation: 'LAL',
        city: 'Los Angeles',
        conference: 'West',
        division: 'Pacific',
        full_name: 'Los Angeles Lakers',
        name: 'Lakers',
      },
      visitor_team_score: 0,
    },
    {
      id: 857440,
      date: '2022-10-29T00:00:00.000Z',
      home_team: {
        id: 7,
        abbreviation: 'DAL',
        city: 'Dallas',
        conference: 'West',
        division: 'Southwest',
        full_name: 'Dallas Mavericks',
        name: 'Mavericks',
      },
      home_team_score: 0,
      period: 0,
      postseason: false,
      season: 2022,
      status: '9:00 PM ET',
      time: '',
      visitor_team: {
        id: 21,
        abbreviation: 'OKC',
        city: 'Oklahoma City',
        conference: 'West',
        division: 'Northwest',
        full_name: 'Oklahoma City Thunder',
        name: 'Thunder',
      },
      visitor_team_score: 0,
    },
  ],
  meta: {
    total_pages: 24,
    current_page: 1,
    next_page: 2,
    per_page: 50,
    total_count: 1161,
  },
}

jest.mock('@remix-run/node', () => ({
  fetch: mockFetch,
}))

describe.skip('getGames', () => {
  beforeEach(() => {
    mockFetch.mockClear()
  })

  it('should return list of games', async () => {
    // mockFetch.mockResolvedValue(mockResponse(mockGames))

    // const expectedResults = await getGames()

    // expect(expectedResults).toEqual(mapGamesData(mockGames.data))

    expect(true).toBeTruthy()
  })
})

Jest Config

/** @type {import(@jest/types).Config.InitialOptions} */

module.exports = {
  collectCoverage: true,
  collectCoverageFrom: [
    '<rootDir>/src/**/*.{js,jsx,ts,tsx}',
    '!**/*.d.ts',
    '!**/entry.*.*',
    '!**/node_modules/**',
    '!**/root.*',
    '!**/routes/**',
    '!**/index.*',
  ],
  coverageDirectory: '<rootDir>/reports',

  coverageReporters: ['json', 'lcov', 'text'],

  coverageThreshold: {
    global: {
      branches: 80,
      functions: 80,
      lines: 50,
      statements: 50,
    },
  },

  moduleDirectories: ['node_modules', '<rootDir>/node_modules'],

  setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],

  testEnvironment: 'jsdom',

  testPathIgnorePatterns: ['<rootDir>/node_modules/'],

  transform: {
    // https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
    '^.+\\.[jt]sx?$': [
      'babel-jest',
      {
        presets: [
          '@babel/preset-env',
          ['@babel/preset-react', { runtime: 'automatic' }],
          '@babel/preset-typescript',
        ],
        plugins: ['@babel/plugin-transform-runtime'],
      },
    ],
  },
}

Jest Setup file

import '@testing-library/jest-dom/extend-expect'

import { installGlobals } from '@remix-run/node'
import { configure } from '@testing-library/react'

configure({ testIdAttribute: 'data-test' })

installGlobals()

Source Code - Dev Branch

Error


问:
blazor monitor all keyup events
Using jquery we can use the $(document).ready function to monitor all textarea keyboard events on the page and update their text counter:

```<code>$(document).ready(function () {
$("textarea").keyup(function () {
    var maxLength = $(this).attr("maxlength");
    var currLength = $(this).val().length;
    var spanid = $(this).attr("id") + "_counter";
    $("#" + spanid).val(maxLength - currLength);
    });
});
</code>```

But in blazor the document.ready does not work. After some research I found discussion about using OnAfterRenderAsync to achieve the same effect. The problem is, in this way, each textarea needs to be wired up individually. I'm hoping to find a way similar to the jquery method, so as long as I lay some scripts on the page it can handle additional stuff I throw onto the page.

Thank you.

Title: blazor monitor all keyup events

Body:
Using jquery we can use the $(document).ready function to monitor all textarea keyboard events on the page and update their text counter:

$(document).ready(function () {
$("textarea").keyup(function () {
    var maxLength = $(this).attr("maxlength");
    var currLength = $(this).val().length;
    var spanid = $(this).attr("id") + "_counter";
    $("#" + spanid).val(maxLength - currLength);
    });
});

But in blazor the document.ready does not work. After some research I found discussion about using OnAfterRenderAsync to achieve the same effect. The problem is, in this way, each textarea needs to be wired up individually. I'm hoping to find a way similar to the jquery method, so as long as I lay some scripts on the page it can handle additional stuff I throw onto the page.

Thank you.


问:
Create web3 signature
I'm trying to connect metamask to third-party website using web3.js
So I need to sign signature which containts address and nonce
The problem is i can't get the same signature as by manual metamask with browser
I think I can't understand how exactly the signature is built
Any idead, how i can do that?

metamasak message

```<code>message = {
        address: '0xf82Fa3FC08087a1837d5374172F881C2bF74db36',
        nonce: '0xc1fb834b1bdb671d20df6fe6ca3e8fdde2a8d424acb1c69510e56d2ff9a56aee'
    }
    let signature = web3.eth.accounts.sign(message, privateKey).signature;
</code>```

Title: Create web3 signature

Body:
I'm trying to connect metamask to third-party website using web3.js
So I need to sign signature which containts address and nonce
The problem is i can't get the same signature as by manual metamask with browser
I think I can't understand how exactly the signature is built
Any idead, how i can do that?

metamasak message

message = {
        address: '0xf82Fa3FC08087a1837d5374172F881C2bF74db36',
        nonce: '0xc1fb834b1bdb671d20df6fe6ca3e8fdde2a8d424acb1c69510e56d2ff9a56aee'
    }
    let signature = web3.eth.accounts.sign(message, privateKey).signature;


问:
ENV ["RAILS_MASTER_KEY"] works for master.key, but what environment variable will rails check for development.key or production.key
I have been trying to put my rails credential keys into a environment variable.  The Rails Guide says:

Rails uses config/master.key or alternatively looks for the environment variable "RAILS_MASTER_KEY" to encrypt the credentials file.

I'm running Rails 7, and I have a different credentials file for each Rails environment, i.e.

config/credentials/

```<code>development.yml.enc
development.key
production.yml.enc
production.key
</code>```

So it says I can use "RAILS_MASTER_KEY"] to override any of these .key files.  I'm trying to figure out a way to use an environment variable like "RAILS_DEV_KEY" in place of development.key, for instance.

When I run this:

Rails.application.credentials

I get this:

Is there a way to change the "@env_key" variable above to say "RAILS_DEV_KEY"

Body:
I have been trying to put my rails credential keys into a environment variable.  The Rails Guide says:

Rails uses config/master.key or alternatively looks for the environment variable "RAILS_MASTER_KEY" to encrypt the credentials file.

I'm running Rails 7, and I have a different credentials file for each Rails environment, i.e.

config/credentials/

development.yml.enc
development.key
production.yml.enc
production.key

So it says I can use "RAILS_MASTER_KEY"] to override any of these .key files.  I'm trying to figure out a way to use an environment variable like "RAILS_DEV_KEY" in place of development.key, for instance.

When I run this:

Rails.application.credentials

I get this:

Is there a way to change the "@env_key" variable above to say "RAILS_DEV_KEY"


问:
How to configure java 9 module with many shared java 8 dependencies?
I have a project where dependencies were designed based on java 8, I'm using java 9 modules. I keep getting errors related to multiple exports.

```<code>java: java.lang.reflect.InvocationTargetException
Modules nd4j.common and nd4j.api export package org.nd4j.linalg.util to module jai.imageio.core
</code>```

Do I need to map out every dependency tree, find the duplicates and make exclusions? Some dependencies have upwards of 12 dependencies that also have their own dependencies. Is there a better way? Java 9 modules are becoming a huge needless headache if not.

Here are the libraries I'm using:
Deeplearning4j-core,
Deeplearning4j-ui,
deeplearning4j-zoo,
nd4j-native-platform,
javacv,
lombok,
javafx-controls,
javafx-fxml,
javafx-media,
controls-fx,
formsfx-core

I tried creating an Excel spreadsheet of all my dependencies' dependencies, found the ones that were duplicates, and made the appropriate exclusions in pom.xml. I'm still getting multiple export errors but they are now libraries that I'm not even sure where they are because they aren't ones I've imported but rather a child dependency somewhere that is in common with another child somewhere.

Thank you for looking!

Body:
I have a project where dependencies were designed based on java 8, I'm using java 9 modules. I keep getting errors related to multiple exports.

java: java.lang.reflect.InvocationTargetException
Modules nd4j.common and nd4j.api export package org.nd4j.linalg.util to module jai.imageio.core

Do I need to map out every dependency tree, find the duplicates and make exclusions? Some dependencies have upwards of 12 dependencies that also have their own dependencies. Is there a better way? Java 9 modules are becoming a huge needless headache if not.

Here are the libraries I'm using:
Deeplearning4j-core,
Deeplearning4j-ui,
deeplearning4j-zoo,
nd4j-native-platform,
javacv,
lombok,
javafx-controls,
javafx-fxml,
javafx-media,
controls-fx,
formsfx-core

I tried creating an Excel spreadsheet of all my dependencies' dependencies, found the ones that were duplicates, and made the appropriate exclusions in pom.xml. I'm still getting multiple export errors but they are now libraries that I'm not even sure where they are because they aren't ones I've imported but rather a child dependency somewhere that is in common with another child somewhere.

Thank you for looking!


问:
Get elastic shards failure upon search query across multiple indices (while creating indices)
I am using elastic 7.13.1. I create indices dynamically using a template based on the year of a timestamp field. So when i try to index a document with a timestamp for 2023-01-01Txxxx into index index-2023 the index will be created via the template if missing. I create the index with 5 shards and default number of replicas.

I also query multiple indices at once using the wildcard index-*. I use golang and the github.com/olivere/elastic/v7 (v7.0.32) client library.

I am running a test with a clean elastic setup (no indices created) that run a go routine to index one document per year (up to N years) and one go routine that searches for some documents (using the wildcard indices). I parse the result for shard failures and often get failures like:

[{"index":"index-2023","reason":{"index":"index-2023","index_uuid":"HQU0FmsvSDuar08SUD9lwg","reason":"[d35c437ed6dc][192.168.10.11:9300][indices:data/read/search[phase/query]]","shard":"0","type":"no_shard_available_action_exception"}},{"shard":4,"index":"index-2023","reason":{"index":"index-2023","index_uuid":"HQU0FmsvSDuar08SUD9lwg","reason":null,"shard":"4","type":"no_shard_available_action_exception"}}]

Suggesting to me that while searching the wildcard indices the new index is created by the template but not "yet" fully available. If my assumption is correct, is there a way to prevent such shard failure (e.g. wait that all shards are available before letting the newly created index available for searches)?

Searched using wildcard index (index-*) while indexing documents leading to the creation of new indices using the template. I was expecting no shard failures.


问:
Plotting histograms for several folders with a PyROOT loop
I would like to ask how to solve this error in my pyROOT code on lxplus (ssh server):
This is two code sections:

```<code>def mkdir_p(path):
    #print "Making dir: ", path
    try:
        os.makedirs(path)
    except OSError as exc:
        #print("OS error: {0}".format(exc))
        if exc.errno != errno.EEXIST:
          raise
        pass
        if exc.errno == errno.EEXIST and os.path.isdir(path):
            pass
        #possibly handle other errno cases here, otherwise finally:
        else:
            raise Exception('Unknown exception')

def loop2Dir(hist1,hist2,spec1,spec2,n,opath=""):
    if hist1.IsA().InheritsFrom("TDirectoryFile") == True:
        opath = opath +"/"+hist2.GetName()
        mkdir_p(opath)
        a=0
        dic={}
        for key in hist2.GetListOfKeys():
            dic[key.GetName()]=key
</code>```

And this is the output error on lxplus (ssh server):

```<code>Traceback (most recent call last):
  File "code_name.py", line 309, in <module>
    loop2Dir(obj1,obj2,specific,specific2,n,output_path_op)
  File "code_name.py", line 178, in loop2Dir
    loop2Dir(obj1,obj2,spec1,spec2,opath)
  File "code_name.py", line 178, in loop2Dir
    loop2Dir(obj1,obj2,spec1,spec2,opath)
  File "code_name.py", line 164, in loop2Dir
    mkdir_p(opath)
  File "code_name.py", line 9, in mkdir_p
    os.makedirs(path)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/DiTauHLT_Efficiency'
</code>```

Any feedback is useful, thanks in advance.

To date my code can make only 1 directory and then the error appears in the output.
I'm trying to make my code analyze 211 folders in a source path for plotting histograms from several .root files

Body:
I would like to ask how to solve this error in my pyROOT code on lxplus (ssh server):
This is two code sections:

def mkdir_p(path):
    #print "Making dir: ", path
    try:
        os.makedirs(path)
    except OSError as exc:
        #print("OS error: {0}".format(exc))
        if exc.errno != errno.EEXIST:
          raise
        pass
        if exc.errno == errno.EEXIST and os.path.isdir(path):
            pass
        #possibly handle other errno cases here, otherwise finally:
        else:
            raise Exception('Unknown exception')

def loop2Dir(hist1,hist2,spec1,spec2,n,opath=""):
    if hist1.IsA().InheritsFrom("TDirectoryFile") == True:
        opath = opath +"/"+hist2.GetName()
        mkdir_p(opath)
        a=0
        dic={}
        for key in hist2.GetListOfKeys():
            dic[key.GetName()]=key

And this is the output error on lxplus (ssh server):

Traceback (most recent call last):
  File "code_name.py", line 309, in <module>
    loop2Dir(obj1,obj2,specific,specific2,n,output_path_op)
  File "code_name.py", line 178, in loop2Dir
    loop2Dir(obj1,obj2,spec1,spec2,opath)
  File "code_name.py", line 178, in loop2Dir
    loop2Dir(obj1,obj2,spec1,spec2,opath)
  File "code_name.py", line 164, in loop2Dir
    mkdir_p(opath)
  File "code_name.py", line 9, in mkdir_p
    os.makedirs(path)
  File "/usr/lib64/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/DiTauHLT_Efficiency'

Any feedback is useful, thanks in advance.

To date my code can make only 1 directory and then the error appears in the output.
I'm trying to make my code analyze 211 folders in a source path for plotting histograms from several .root files


问:
I have a cookie in json format , there are multiple key values in this json but i need to print only one key value
I have a cookie in json format , there are multiple key values in this json but i need to print only one key value ex: just userId from whole cookie json. How to print it using nginx.

We tried using map but it is showing whole cookie info, can you please help.


问:
why would ffmpeg rotate 2nd video on concatenation when I don't want it to or seemingly ask for it?
here is the command I run:

```<code>ffmpeg -f concat -an -i ./files.txt ztestout.mp4
</code>```

I have about 5 videos, but just to test I did with two.
the 2nd video gets flipped upside down, even though opening each video in VLC opens and plays them correctly.

Any ideas why it would do that?  Is the metadata wrong in the video?  I took all the videos I'm trying to concat with the same android phone.

output below, and I noticed its says rotation zero degrees:

```<code>ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.102)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x138804730] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from './files.txt':
  Duration: N/A, start: 0.000000, bitrate: 17255 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m, progressive), 1920x1080, 16999 kb/s, SAR 1:1 DAR 16:9, 30.01 fps, 30 tbr, 90k tbn
    Metadata:
      creation_time   : 2023-01-08T13:32:50.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of -180.00 degrees
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
    Metadata:
      creation_time   : 2023-01-08T13:32:50.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x137f07fe0] using SAR=1/1
[libx264 @ 0x137f07fe0] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x137f07fe0] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x137f07fe0] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'ztestout.mp4':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p(pc, smpte170m, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn
    Metadata:
      creation_time   : 2023-01-08T13:32:50.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
      displaymatrix: rotation of -0.00 degrees
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x138904b40] Auto-inserting h264_mp4toannexb bitstream filterdrop=20 speed=3.67x
frame=74497 fps=109 q=-1.0 Lsize= 1740353kB time=00:41:23.13 bitrate=5741.5kbits/s dup=0 drop=25 speed=3.64x
video:1739531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.047236%
[libx264 @ 0x137f07fe0] frame I:300   Avg QP:20.73  size:294110
[libx264 @ 0x137f07fe0] frame P:29265 Avg QP:23.65  size: 45500
[libx264 @ 0x137f07fe0] frame B:44932 Avg QP:27.95  size:  8045
[libx264 @ 0x137f07fe0] consecutive B-frames: 19.4%  0.4%  0.7% 79.5%
[libx264 @ 0x137f07fe0] mb I  I16..4:  5.5% 43.8% 50.7%
[libx264 @ 0x137f07fe0] mb P  I16..4:  0.2%  0.9%  0.7%  P16..4: 36.9% 13.9% 10.8%  0.0%  0.0%    skip:36.6%
[libx264 @ 0x137f07fe0] mb B  I16..4:  0.0%  0.1%  0.1%  B16..8: 30.0%  3.0%  1.3%  direct: 1.1%  skip:64.3%  L0:38.1% L1:55.8% BI: 6.1%
[libx264 @ 0x137f07fe0] 8x8 transform intra:49.7% inter:45.0%
[libx264 @ 0x137f07fe0] coded y,uvDC,uvAC intra: 84.0% 82.3% 41.9% inter: 12.8% 10.8% 0.5%
[libx264 @ 0x137f07fe0] i16 v,h,dc,p: 30% 17%  8% 45%
[libx264 @ 0x137f07fe0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 25% 12%  4%  7%  7% 12%  7%  8%
[libx264 @ 0x137f07fe0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 25% 12%  5%  7%  7% 10%  6%  8%
[libx264 @ 0x137f07fe0] i8c dc,h,v,p: 47% 22% 22%  9%
[libx264 @ 0x137f07fe0] Weighted P-Frames: Y:0.3% UV:0.0%
[libx264 @ 0x137f07fe0] ref P L0: 70.3% 10.7% 13.9%  5.0%  0.0%
[libx264 @ 0x137f07fe0] ref B L0: 91.8%  6.2%  2.0%
[libx264 @ 0x137f07fe0] ref B L1: 95.7%  4.3%
[libx264 @ 0x137f07fe0] kb/s:5738.58
</code>```

Body:
here is the command I run:

ffmpeg -f concat -an -i ./files.txt ztestout.mp4

I have about 5 videos, but just to test I did with two.
the 2nd video gets flipped upside down, even though opening each video in VLC opens and plays them correctly.

Any ideas why it would do that?  Is the metadata wrong in the video?  I took all the videos I'm trying to concat with the same android phone.

output below, and I noticed its says rotation zero degrees:

ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 14.0.0 (clang-1400.0.29.102)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x138804730] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from './files.txt':
  Duration: N/A, start: 0.000000, bitrate: 17255 kb/s
  Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m, progressive), 1920x1080, 16999 kb/s, SAR 1:1 DAR 16:9, 30.01 fps, 30 tbr, 90k tbn
    Metadata:
      creation_time   : 2023-01-08T13:32:50.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
    Side data:
      displaymatrix: rotation of -180.00 degrees
  Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
    Metadata:
      creation_time   : 2023-01-08T13:32:50.000000Z
      handler_name    : SoundHandle
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x137f07fe0] using SAR=1/1
[libx264 @ 0x137f07fe0] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x137f07fe0] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x137f07fe0] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'ztestout.mp4':
  Metadata:
    encoder         : Lavf59.27.100
  Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p(pc, smpte170m, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn
    Metadata:
      creation_time   : 2023-01-08T13:32:50.000000Z
      handler_name    : VideoHandle
      vendor_id       : [0][0][0][0]
      encoder         : Lavc59.37.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
      displaymatrix: rotation of -0.00 degrees
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x138904b40] Auto-inserting h264_mp4toannexb bitstream filterdrop=20 speed=3.67x
frame=74497 fps=109 q=-1.0 Lsize= 1740353kB time=00:41:23.13 bitrate=5741.5kbits/s dup=0 drop=25 speed=3.64x
video:1739531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.047236%
[libx264 @ 0x137f07fe0] frame I:300   Avg QP:20.73  size:294110
[libx264 @ 0x137f07fe0] frame P:29265 Avg QP:23.65  size: 45500
[libx264 @ 0x137f07fe0] frame B:44932 Avg QP:27.95  size:  8045
[libx264 @ 0x137f07fe0] consecutive B-frames: 19.4%  0.4%  0.7% 79.5%
[libx264 @ 0x137f07fe0] mb I  I16..4:  5.5% 43.8% 50.7%
[libx264 @ 0x137f07fe0] mb P  I16..4:  0.2%  0.9%  0.7%  P16..4: 36.9% 13.9% 10.8%  0.0%  0.0%    skip:36.6%
[libx264 @ 0x137f07fe0] mb B  I16..4:  0.0%  0.1%  0.1%  B16..8: 30.0%  3.0%  1.3%  direct: 1.1%  skip:64.3%  L0:38.1% L1:55.8% BI: 6.1%
[libx264 @ 0x137f07fe0] 8x8 transform intra:49.7% inter:45.0%
[libx264 @ 0x137f07fe0] coded y,uvDC,uvAC intra: 84.0% 82.3% 41.9% inter: 12.8% 10.8% 0.5%
[libx264 @ 0x137f07fe0] i16 v,h,dc,p: 30% 17%  8% 45%
[libx264 @ 0x137f07fe0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 25% 12%  4%  7%  7% 12%  7%  8%
[libx264 @ 0x137f07fe0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 25% 12%  5%  7%  7% 10%  6%  8%
[libx264 @ 0x137f07fe0] i8c dc,h,v,p: 47% 22% 22%  9%
[libx264 @ 0x137f07fe0] Weighted P-Frames: Y:0.3% UV:0.0%
[libx264 @ 0x137f07fe0] ref P L0: 70.3% 10.7% 13.9%  5.0%  0.0%
[libx264 @ 0x137f07fe0] ref B L0: 91.8%  6.2%  2.0%
[libx264 @ 0x137f07fe0] ref B L1: 95.7%  4.3%
[libx264 @ 0x137f07fe0] kb/s:5738.58


问:
Why do I ger "Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client"?
I have a Users class like below:

```<code>class Users {

  static async findAll(req: Request, res: Response, next: NextFunction) {
    await Pools.execute("SELECT * FROM users")
      .then((rows) => {
        res.status(200).json(rows[0]);
      })
      .catch(err => {
        res.status(404).json({error: err});
        throw err;
        });
    next();

  }
}
</code>```

And a usersRouter like following:

```<code>router.route("/api/users")
  .get(Users.findAll);
</code>```

When I send a get request to localhost:3000/api/users I get the users list back but alongside with an Error as following:

```<code>Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
</code>```

PS: The pool is a mysql2/promise pool.

Body:
I have a Users class like below:

class Users {

  static async findAll(req: Request, res: Response, next: NextFunction) {
    await Pools.execute("SELECT * FROM users")
      .then((rows) => {
        res.status(200).json(rows[0]);
      })
      .catch(err => {
        res.status(404).json({error: err});
        throw err;
        });
    next();

  }
}

And a usersRouter like following:

router.route("/api/users")
  .get(Users.findAll);

When I send a get request to localhost:3000/api/users I get the users list back but alongside with an Error as following:

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

PS: The pool is a mysql2/promise pool.


问:
Running a C++ project with makefile but getting linking errors for source files in subdirectories
I've been trying to get a c++ project to build using this makefile:

https://pastebin.com/vMEMwH4C

The structure of my project is like this:

For context, I'm using a library called Raylib and trying to run on a windows machine. This makefile was provided with a project template and worked just fine before I tried to modify it to run with C++ instead of C and tried to include my source directories for the project instead of including just the main.cpp file.

It compiles just fine, but the linking is where I keep running into issues.

Here's the output when I run the make file:

```<code>Executing task in folder VSCode: C:/raylib/w64devkit/bin/mingw32-make.exe RAYLIB_PATH=C:/raylib/raylib PROJECT_NAME=main OBJS=src/main.cpp BUILD_MODE=DEBUG

i686-w64-mingw32-g++ -o main src/main.cpp -Wall -std=c++17 -D_DEFAULT_SOURCE -Wno-missing-braces -g -O0 C:/raylib/raylib/src/raylib.rc.data -Wl,--subsystem,windows -I. -IC:/raylib/raylib/src -IC:/raylib/raylib/src/external -Ilib/ -Ilib/util -Ilib/systems -Ilib/core -Ilib/components -ID://boost_1_81_0 -L. -LC:/raylib/raylib/src -LC:/raylib/raylib/src -lraylib -lopengl32 -lgdi32 -lwinmm -DPLATFORM_DESKTOP

...

C:/raylib/w64devkit/bin/ld.exe: C:\Users\Josh\AppData\Local\Temp\cczAGA5y.o: in function `Z4initv':
D:\Documents\WindowsRaylib\VSCode/src/main.cpp:276: undefined reference to `LocationManager::moveToLocation(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long, unsigned long long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, MapLocation&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MapLocation, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, MapLocation> > >&, entt::basic_registry<entt::entity, std::allocator<entt::entity> >&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)'

... (and a bunch more of messages like these)....

collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:408: main] Error 1

</code>```

I've been looking through many posts trying to figure out how to include the right subdirectories in the linking process, but nothing seems to work. I would really appreciate some help!

(one odd thing I noticed is that the object file mentioned in the error "C:\Users\Josh\AppData\Local\Temp\cczAGA5y.o" is in the AppData folder, not my actual project folder. I can't figure out why, though.)

Body:
I've been trying to get a c++ project to build using this makefile:

https://pastebin.com/vMEMwH4C

The structure of my project is like this:

For context, I'm using a library called Raylib and trying to run on a windows machine. This makefile was provided with a project template and worked just fine before I tried to modify it to run with C++ instead of C and tried to include my source directories for the project instead of including just the main.cpp file.

It compiles just fine, but the linking is where I keep running into issues.

Here's the output when I run the make file:

Executing task in folder VSCode: C:/raylib/w64devkit/bin/mingw32-make.exe RAYLIB_PATH=C:/raylib/raylib PROJECT_NAME=main OBJS=src/main.cpp BUILD_MODE=DEBUG

i686-w64-mingw32-g++ -o main src/main.cpp -Wall -std=c++17 -D_DEFAULT_SOURCE -Wno-missing-braces -g -O0 C:/raylib/raylib/src/raylib.rc.data -Wl,--subsystem,windows -I. -IC:/raylib/raylib/src -IC:/raylib/raylib/src/external -Ilib/ -Ilib/util -Ilib/systems -Ilib/core -Ilib/components -ID://boost_1_81_0 -L. -LC:/raylib/raylib/src -LC:/raylib/raylib/src -lraylib -lopengl32 -lgdi32 -lwinmm -DPLATFORM_DESKTOP

...

C:/raylib/w64devkit/bin/ld.exe: C:\Users\Josh\AppData\Local\Temp\cczAGA5y.o: in function `Z4initv':
D:\Documents\WindowsRaylib\VSCode/src/main.cpp:276: undefined reference to `LocationManager::moveToLocation(nlohmann::json_abi_v3_11_2::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long long, unsigned long long, double, std::allocator, nlohmann::json_abi_v3_11_2::adl_serializer, std::vector<unsigned char, std::allocator<unsigned char> > > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, MapLocation&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, MapLocation, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, MapLocation> > >&, entt::basic_registry<entt::entity, std::allocator<entt::entity> >&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&)'

... (and a bunch more of messages like these)....

collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:408: main] Error 1

I've been looking through many posts trying to figure out how to include the right subdirectories in the linking process, but nothing seems to work. I would really appreciate some help!

(one odd thing I noticed is that the object file mentioned in the error "C:\Users\Josh\AppData\Local\Temp\cczAGA5y.o" is in the AppData folder, not my actual project folder. I can't figure out why, though.)


问:
Making material rows smaller
I have this project on stack-blitz (https://stackblitz.com/edit/angular-ivy-gn5oth).
I am using material library to display Date time in one of my columns in the table - like below:

```<code><ng-container matColumnDef="date">
  <th mat-header-cell *matHeaderCellDef> Date </th>
  <td mat-cell *matCellDef="let element">
    <mat-form-field appearance="outline">
      <input matInput [ngxMatDatetimePicker]="picker" (dateChange)="onDateChanged($event, element)"
        [value]="element.date">
      <mat-datepicker-toggle matIconSuffix [for]="$any(picker)"></mat-datepicker-toggle>
      <ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="false" [stepHour]="1" [stepMinute]="1"
        [stepSecond]="1" [touchUi]="true" [color]="color" [enableMeridian]="false" [disableMinute]="false"
        [hideTime]="false">
      </ngx-mat-datetime-picker>
    </mat-form-field>
  </td>
</ng-container>
</code>```

My problem is that if I add the date time picker control to the table cell, the rows become very big (in both directions).
Is there any way of making rows smaller?

I have done a few things:

I have followed instructions from answer1

I have removed elements th/td and replaced them with mat-header-cell/mat-cell.

So with the table defined like this:

```<code><table mat-table #table [dataSource]="dataSource" matSort style="height: 300px; width: 300px;">
    <ng-container matColumnDef="date">
        <mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
        <mat-cell *matCellDef="let schedule" style="height: 20px;" fxFlex="1 0 auto">
            <mat-form-field appearance="outline" style="max-height: 15px;">
                <input matInput [ngxMatDatetimePicker]="picker" (dateChange)="onDateChanged($event, schedule)"
                    [value]="getDisplayDate(schedule.date)">
                <mat-datepicker-toggle matIconSuffix [for]="$any(picker)"></mat-datepicker-toggle>
                <ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="false" [stepHour]="1"
                    [stepMinute]="1" [stepSecond]="1" [touchUi]="true" [color]="color" [enableMeridian]="false"
                    [disableMinute]="false" [hideTime]="false">
                </ngx-mat-datetime-picker>
            </mat-form-field>
        </mat-cell>
    </ng-container>
    <ng-container matColumnDef="userFunction">
        <mat-header-cell *matHeaderCellDef mat-sort-header> Duty </mat-header-cell>
        <mat-cell *matCellDef="let schedule" style="height: 20px;" fxFlex="1 0 auto">
            <mat-form-field appearance="outline" style="max-height: 15px;">
                <mat-select placeholder={{schedule.userFunction}}
                    (selectionChange)="onUserFunctionChanged($event, schedule)">
                    <mat-option *ngFor="let f of userFunctions" [value]="f.userFunction">
                        {{ f.userFunction }}
                    </mat-option>
                </mat-select>
            </mat-form-field>
        </mat-cell>
    </ng-container>
    <ng-container matColumnDef="action">
        <mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
        <mat-cell *matCellDef="let row" style="height: 20px;" fxFlex="1 0 auto">
            <span *ngIf="row.deleting" class="spinner-border spinner-border-sm mr-1"></span>
            <button mat-raised-button color="warn" (click)="onDeleteSchedule(row.id)">Delete
            </button>
        </mat-cell>
    </ng-container>
    <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
    <mat-row *matRowDef="let row; columns: displayedColumns;"
        [ngClass]="{hovered: row.hovered}" (mouseover)="row.hovered = true"
        (mouseout)="row.hovered = false" #tr (click)="onRowSelected(row, tr)">
    </mat-row>
</table>
</code>```

I got almost what I want but not quite:

I don't know why the rows are cut of to 2/3 of their height.

Title: Making material rows smaller

Body:
I have this project on stack-blitz (https://stackblitz.com/edit/angular-ivy-gn5oth).
I am using material library to display Date time in one of my columns in the table - like below:

<ng-container matColumnDef="date">
   Date

    <mat-form-field appearance="outline">
      <input matInput [ngxMatDatetimePicker]="picker" (dateChange)="onDateChanged($event, element)"
        [value]="element.date">
      <mat-datepicker-toggle matIconSuffix [for]="$any(picker)"></mat-datepicker-toggle>
      <ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="false" [stepHour]="1" [stepMinute]="1"
        [stepSecond]="1" [touchUi]="true" [color]="color" [enableMeridian]="false" [disableMinute]="false"
        [hideTime]="false">
      </ngx-mat-datetime-picker>
    </mat-form-field>

</ng-container>

My problem is that if I add the date time picker control to the table cell, the rows become very big (in both directions).
Is there any way of making rows smaller?

I have done a few things:

I have followed instructions from answer1

I have removed elements th/td and replaced them with mat-header-cell/mat-cell.

So with the table defined like this:

    <ng-container matColumnDef="date">
        <mat-header-cell *matHeaderCellDef mat-sort-header> Date </mat-header-cell>
        <mat-cell *matCellDef="let schedule" style="height: 20px;" fxFlex="1 0 auto">
            <mat-form-field appearance="outline" style="max-height: 15px;">
                <input matInput [ngxMatDatetimePicker]="picker" (dateChange)="onDateChanged($event, schedule)"
                    [value]="getDisplayDate(schedule.date)">
                <mat-datepicker-toggle matIconSuffix [for]="$any(picker)"></mat-datepicker-toggle>
                <ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="false" [stepHour]="1"
                    [stepMinute]="1" [stepSecond]="1" [touchUi]="true" [color]="color" [enableMeridian]="false"
                    [disableMinute]="false" [hideTime]="false">
                </ngx-mat-datetime-picker>
            </mat-form-field>
        </mat-cell>
    </ng-container>
    <ng-container matColumnDef="userFunction">
        <mat-header-cell *matHeaderCellDef mat-sort-header> Duty </mat-header-cell>
        <mat-cell *matCellDef="let schedule" style="height: 20px;" fxFlex="1 0 auto">
            <mat-form-field appearance="outline" style="max-height: 15px;">
                <mat-select placeholder={{schedule.userFunction}}
                    (selectionChange)="onUserFunctionChanged($event, schedule)">
                    <mat-option *ngFor="let f of userFunctions" [value]="f.userFunction">
                        {{ f.userFunction }}
                    </mat-option>
                </mat-select>
            </mat-form-field>
        </mat-cell>
    </ng-container>
    <ng-container matColumnDef="action">
        <mat-header-cell *matHeaderCellDef> Action </mat-header-cell>
        <mat-cell *matCellDef="let row" style="height: 20px;" fxFlex="1 0 auto">

            <button mat-raised-button color="warn" (click)="onDeleteSchedule(row.id)">Delete
            </button>
        </mat-cell>
    </ng-container>
    <mat-header-row *matHeaderRowDef="displayedColumns"></mat-header-row>
    <mat-row *matRowDef="let row; columns: displayedColumns;"
        [ngClass]="{hovered: row.hovered}" (mouseover)="row.hovered = true"
        (mouseout)="row.hovered = false" #tr (click)="onRowSelected(row, tr)">
    </mat-row>

I got almost what I want but not quite:

I don't know why the rows are cut of to 2/3 of their height.