Double column collection Map and its subclasses

Double-column collection Map and its subclasses Map collection HashMap collection LinkedHashMap collection TreeMap collection Map collection Map set is the ancestor class of all double-column sets. The so-called double-column set means that an element in the set is composed of two parts, namely key and value, also called key-value pair. The elements in the Map […]

Single column collection Collection and its subclasses

Common singleton collections Preface Collection collection List collection ArrayList collection LInkedList collection Set set HashSet collection TreeSet collection Foreword Here, each collection traversal method and method is repeated, so only the traversal methods and methods will be discussed in the Collection collection. If there are unique collection traversal methods and methods, they will be discussed […]

Inheritance, calling, and parameter passing of subclasses and parent classes in Python

1.Inheritance In Python, the relationship between subclasses and parent classes is achieved through inheritance. Inheritance allows subclasses to inherit the properties and methods of the parent class, and can also add new properties and methods to the subclass, or override the methods of the parent class. Here is a simple example that shows how to […]

Inheritance, Object class, method overriding, subclass constructor, similar constructor

1. What is inheritance? What are the characteristics of inheritance? ·Inheritance is to use the extends keyword to establish a parent-child relationship between one class and another class. Subclasses can inherit non-private members of the parent class. 2. For a class with inheritance relationship, how does Java create its object? After the object is created, […]

Use of importlib, 9 view subclasses, viewset, drf route, drf request response review, GenericViewSet related flow chart

A review of drf request response # 1 drf request -Request object: data, query_params, others are the same as before, FILES -Default: supports three encodings -Local configuration: in view class -from rest_framework.parsers import JSONParser, FormParser, MultiPartParser -parser_classes=[JSONParser] -Global configuration: REST_FRAMEWORK = {<!– –> ‘DEFAULT_PARSER_CLASSES’: [ ‘rest_framework.parsers.JSONParser’, ‘rest_framework.parsers.FormParser’, ‘rest_framework.parsers.MultiPartParser’ ], } – Use it globally, change […]

drf’s view subclasses, viewsets, and routing

1 9 view subclasses The 9 view subclasses are a combination of GenericAPIView and 5 view extension classes Import through from rest_framework.generics import , and when writing a view class, you only need to inherit the view subclass ListAPIView, only used to display all CreateAPIView, add a ListCreateAPIView, display all and add one RetrieveAPIView, displays […]

drf interface-Written by myself, inherit APIView and write books with 5 interfaces, inherit APIView, have two class attributes, extend classes based on 5 views, and write interfaces and view sets through 9 view subclasses

1. The first layer, written by ourselves, inherits APIView and writes 5 interfaces for books 1.Routing path(‘books/’, BookView.as_view()), path(‘books/<int:pk>/’, BookDetailView.as_view()), path(‘publish/’, PublishView.as_view()), path(‘publish/<int:pk>/’, PublishDetailView.as_view()), 2.serializer class class PublishSerializer(serializers.ModelSerializer): class Meta: model=Publish fields = ‘__all__’ 3. View function class BookView(APIView): def get(self, request): book = Book.objects.all() ser = BookSerializer(instance=book, many=True) # ser.data is serialized return Response({<!– […]

PyTorch three mainstream model construction methods: nn.Sequential, nn.Module subclasses, nn.Module container development practice, taking real smoke recognition scene data as an example

Keras and PyTorch are two commonly used deep learning frameworks, both of which provide high-level APIs for building and training neural networks. Keras: Keras is a high-level neural network API that can run on multiple low-level deep learning frameworks, such as TensorFlow and CNTK. The following are the features and benefits of Keras: advantage: Easy […]

Keras three mainstream model construction methods: sequence model, function model, and subclass model development practice, taking real smoke recognition scene data as an example

Keras and PyTorch are two commonly used deep learning frameworks, both of which provide high-level APIs for building and training neural networks. Keras: Keras is a high-level neural network API that can run on multiple low-level deep learning frameworks, such as TensorFlow and CNTK. The following are the features and benefits of Keras: advantage: Easy […]

(Keras) Custom subclass subclass model/layer, serialization and model.save(path) preservation

Directory 23.08.09 Custom LayerNormalization layer For custom layers and model calls passed to __int__ in subclassed models 23.08.10 Use the constructor def construct(cla, class_attribute1, class_attribute2) to construct the serialized model 23.08.09 For the problem that the custom subclass subclass model cannot use model.save() to save the entire model, the entire model can be saved by […]