code: def get_dynamic_scale(x, bits, with_grad=False):
      """Calculate dynamic scale for quantization from input by taking the
      maximum absolute value from x and number of bits"""
      with torch.set_grad_enabled(with_grad):
          threshold = x.abs().max()
      return get_scale(bits, threshold)
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from enum import Enum, auto
  import logging
  from abc import ABC, abstractmethod
  import torch
  from torch import nn
  from torch.nn import functional
  from nlp_architect.common import Config
label_desc: Use image node_id 1 for calling a global function with example usage: get_dynamic_scale(x, bits, with_grad) and returns: get_scale